From 479d6b73d9a46e69e6e186342a217c1c26b67e7c Mon Sep 17 00:00:00 2001 From: seawinde Date: Tue, 22 Oct 2024 14:21:54 +0800 Subject: [PATCH] optimize code usage --- .../org/apache/doris/regression/suite/Suite.groovy | 14 ++++++++++---- 1 file changed, 10 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 a0a11e44bb41d6..121ccec79b8b17 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 @@ -1605,7 +1605,8 @@ class Suite implements GroovyInterceptable { check { result -> boolean success = true; for (String mv_name : mv_names) { - success = success && result.contains("(${mv_name})") + def each_result = splitResult.length == 2 ? splitResult[0].contains(mv_name) : false + success = success && each_result } Assert.assertEquals(true, success) } @@ -1636,7 +1637,9 @@ class Suite implements GroovyInterceptable { check { result -> boolean success = false; for (String mv_name : mv_names) { - success = success || result.contains("(${mv_name})") + def splitResult = result.split("MaterializedViewRewriteFail") + def each_result = splitResult.length == 2 ? splitResult[0].contains(mv_name) : false + success = success || each_result } Assert.assertEquals(true, success) } @@ -1645,7 +1648,7 @@ class Suite implements GroovyInterceptable { } explain { sql(" memo plan ${query_sql}") - check {result -> + check { result -> boolean success = false for (String mv_name : mv_names) { success = success || result.contains("${mv_name} chose") || result.contains("${mv_name} not chose") @@ -1663,7 +1666,10 @@ class Suite implements GroovyInterceptable { if (!sync_cbo_rewrite) { explain { sql("${query_sql}") - contains("(${mv_name})") + check { result -> + def splitResult = result.split("MaterializedViewRewriteFail") + splitResult.length == 2 ? splitResult[0].contains(mv_name) : false + } } return }