Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Dec 23, 2024
1 parent 1799aa1 commit 75264b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1362,7 +1364,7 @@ public long getDataSize() {
new Expectations(execMeta2) {
{
execMeta2.getHealthy();
times = 0;
times = 1;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<StatisticsCollectJob> 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<StatisticsCollectJob> collectJobs = StatisticsCollectJobFactory.buildStatisticsCollectJob(analyzeJob);
Assertions.assertEquals(1, collectJobs.size());
Expand Down

0 comments on commit 75264b2

Please sign in to comment.