From bb16b5c509b7311f27e3e36c05179da5f9aa49a3 Mon Sep 17 00:00:00 2001 From: Murphy Date: Mon, 16 Dec 2024 19:17:42 +0800 Subject: [PATCH] fix test Signed-off-by: Murphy --- .../com/starrocks/statistic/StatisticsCollectJobTest.java | 4 +++- .../com/starrocks/statistic/columns/ColumnUsageTest.java | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/test/java/com/starrocks/statistic/StatisticsCollectJobTest.java b/fe/fe-core/src/test/java/com/starrocks/statistic/StatisticsCollectJobTest.java index 71d8c23367e1c..b29dd9de4bcd4 100644 --- a/fe/fe-core/src/test/java/com/starrocks/statistic/StatisticsCollectJobTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/statistic/StatisticsCollectJobTest.java @@ -78,6 +78,7 @@ public static void beforeClass() throws Exception { PlanTestNoneDBBase.beforeClass(); GlobalStateMgr globalStateMgr = connectContext.getGlobalStateMgr(); ConnectorPlanTestBase.mockAllCatalogs(connectContext, temp.newFolder().toURI().toString()); + Config.statistic_auto_collect_predicate_columns_threshold = 0; String dbName = "test"; starRocksAssert.withDatabase(dbName).useDatabase(dbName); @@ -210,6 +211,7 @@ public static void beforeClass() throws Exception { OlapTable structTable = (OlapTable) globalStateMgr.getLocalMetastore().getDb("stats").getTable("struct_a"); new ArrayList<>(structTable.getPartitions()).get(0).getDefaultPhysicalPartition().updateVisibleVersion(2); setTableStatistics(structTable, 20000000); + } @Before @@ -1362,7 +1364,7 @@ public long getDataSize() { new Expectations(execMeta2) { { execMeta2.getHealthy(); - times = 0; + times = 1; } }; diff --git a/fe/fe-core/src/test/java/com/starrocks/statistic/columns/ColumnUsageTest.java b/fe/fe-core/src/test/java/com/starrocks/statistic/columns/ColumnUsageTest.java index 48a248030961b..b7fa679888a66 100644 --- a/fe/fe-core/src/test/java/com/starrocks/statistic/columns/ColumnUsageTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/statistic/columns/ColumnUsageTest.java @@ -204,17 +204,21 @@ public void testAutoAnalyzePredicateColumns() throws Exception { // enable the predicate-columns strategy { + int defaultValue = Config.statistic_auto_collect_predicate_columns_threshold; + Config.statistic_auto_collect_predicate_columns_threshold = 32; + List collectJobs = StatisticsCollectJobFactory.buildStatisticsCollectJob(analyzeJob); Assertions.assertEquals(1, collectJobs.size()); StatisticsCollectJob job0 = collectJobs.get(0); Assertions.assertEquals(StatsConstants.AnalyzeType.FULL, job0.getType()); Assertions.assertEquals(List.of("v1"), job0.getColumnNames()); + + Config.statistic_auto_collect_predicate_columns_threshold = defaultValue; } // disable the strategy { - int defaultValue = - Config.statistic_auto_collect_predicate_columns_threshold; + int defaultValue = Config.statistic_auto_collect_predicate_columns_threshold; Config.statistic_auto_collect_predicate_columns_threshold = 0; List collectJobs = StatisticsCollectJobFactory.buildStatisticsCollectJob(analyzeJob); Assertions.assertEquals(1, collectJobs.size());