From 0ad453110b3ac7c3059460f6cafedf8f2faa6493 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 14 Nov 2024 21:54:28 +0800 Subject: [PATCH] [fix](regression)Fix unstable delta rows case. (#43928) ### What problem does this PR solve? Fix unstable delta rows case. This case assume the table row count is not reported during the execution, but in sometimes the row count may reported, which will cause the case fail. --- .../nereids_p0/delta_row/delta_row.groovy | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/regression-test/suites/nereids_p0/delta_row/delta_row.groovy b/regression-test/suites/nereids_p0/delta_row/delta_row.groovy index c6f40f5363f453..c788cf57b0d062 100644 --- a/regression-test/suites/nereids_p0/delta_row/delta_row.groovy +++ b/regression-test/suites/nereids_p0/delta_row/delta_row.groovy @@ -42,14 +42,34 @@ suite("delta_row") { sql "set global enable_auto_analyze=false;" sql "insert into t values (10, 'c');" - explain { - sql "physical plan select * from t where k > 6" - contains("stats=0.5,") - contains("stats=5(1)") - notContains("stats=0,") - notContains("stats=4 ") + def result = sql """explain physical plan select * from t where k > 6""" + logger.info("result:" + result) + def stringResult = "" + for (int i = 0; i < result.size(); i++) { + stringResult += result[i] + } + logger.info("stringResult:" + stringResult) + if (stringResult.contains("stats=5(1)")) { + logger.info("rows not reported, test analyze rows + delta rows") + assertTrue(stringResult.contains("stats=0.5,")) + assertFalse(stringResult.contains("stats=0,")) + assertFalse(stringResult.contains("stats=4 ")) + } else { + logger.info("rows reported, test use reported rows.") + result = sql """show index stats t t""" + logger.info("index stats: " + result) + assertEquals(1, result.size()) + assertNotEquals("-1", result[0][4]) + } +// explain { +// sql "physical plan select * from t where k > 6" +// contains("stats=0.5,") +// contains("stats=5(1)") +// notContains("stats=0,") +// notContains("stats=4 ") +// cost = 5.00002 // PhysicalResultSink[75] ( outputExprs=[k#0, v#1] ) // +--PhysicalFilter[72]@1 ( stats=0.5, predicates=(k#0 > 6) ) // +--PhysicalOlapScan[t]@0 ( stats=5(1) ) - } -} \ No newline at end of file +} +