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 0143f37997a424..c0e7e6845d202b 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 @@ -145,9 +145,31 @@ suite("test_count_on_index_httplogs", "p0") { sql """set experimental_enable_nereids_planner=true;""" sql """set enable_fallback_to_original_planner=false;""" sql """analyze table ${testTable_dup} with sync"""; - // wait BE report every partition's row count - sleep(10000) // case1: test duplicate table + def maxRetries = 3 + 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 + } + } + } explain { sql("select COUNT() from ${testTable_dup} where request match 'GET'") contains "pushAggOp=COUNT_ON_INDEX"