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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 01c19648979 [Test](count on index) add statistics check for unique 
table #42982 (#43021)
01c19648979 is described below

commit 01c1964897922565931926072d2872f4007c0716
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Thu Oct 31 21:12:37 2024 +0800

    [Test](count on index) add statistics check for unique table #42982 (#43021)
    
    cherry pick from #42982
---
 .../inverted_index_p0/test_count_on_index.groovy   | 48 +++++++++++++---------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git 
a/regression-test/suites/inverted_index_p0/test_count_on_index.groovy 
b/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
index c0e7e6845d2..89d1e8f93b2 100644
--- a/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
+++ b/regression-test/suites/inverted_index_p0/test_count_on_index.groovy
@@ -146,30 +146,38 @@ suite("test_count_on_index_httplogs", "p0") {
         sql """set enable_fallback_to_original_planner=false;"""
         sql """analyze table ${testTable_dup} with sync""";
         // case1: test duplicate table
-        def maxRetries = 3
-        def attempt = 0
-        def success = false
+        def executeSqlWithRetry = { String sqlQuery, int maxRetries = 3, int 
waitSeconds = 1 ->
+            def attempt = 0
+            def success = false
 
-        while (attempt < maxRetries && !success) {
-            try {
-                explain {
-                    sleep(10000)
-                    sql("select COUNT() from ${testTable_dup}")
-                    notContains("cardinality=0")
-                }
-                success = true
-            } catch (Exception e) {
-                attempt++
-                log.error("Attempt ${attempt} failed: ${e.message}")
-                if (attempt < maxRetries) {
-                    log.info("Retrying... (${attempt + 1}/${maxRetries})")
-                    sleep(1000)
-                } else {
-                    log.error("All ${maxRetries} attempts failed.")
-                    throw e
+            while (attempt < maxRetries && !success) {
+                try {
+                    explain {
+                        // Wait for BE to report every partition's row count
+                        sleep(10000)
+                        sql(sqlQuery)
+                        notContains("cardinality=0")
+                    }
+                    success = true
+                } catch (Exception e) {
+                    attempt++
+                    log.error("Attempt ${attempt} failed: ${e.message}")
+                    if (attempt < maxRetries) {
+                        log.info("Retrying... (${attempt + 1}/${maxRetries}) 
after ${waitSeconds} second(s).")
+                        sleep(waitSeconds * 1000)
+                    } else {
+                        log.error("All ${maxRetries} attempts failed.")
+                        throw e
+                    }
                 }
             }
         }
+        // make sure row count stats is not 0 for duplicate table
+        executeSqlWithRetry("SELECT COUNT() FROM ${testTable_dup}")
+        // make sure row count stats is not 0 for unique table
+        sql """analyze table ${testTable_unique} with sync""";
+        executeSqlWithRetry("SELECT COUNT() FROM ${testTable_unique}")
+
         explain {
             sql("select COUNT() from ${testTable_dup} where request match 
'GET'")
             contains "pushAggOp=COUNT_ON_INDEX"


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

Reply via email to