diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java index 281a0e8250..22f0cad9d0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java +++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java @@ -50,11 +50,10 @@ public class ColumnStatisticsCacheLoader extends StatisticsCacheLoader execStatisticQuery(String sql) { return null; } + + @Mock + public TableIf findTable(long catalogId, long dbId, long tblId) { + return table; + } }; new MockUp() { @Mock @@ -229,26 +236,16 @@ public class CacheTest extends TestWithFeService { } }; - new Expectations() { - { - env.getCatalogMgr(); - result = mgr; - - mgr.getCatalog(1); - result = catalog; - - catalog.getDbOrMetaException(1); - result = db; - - db.getTableOrMetaException(1); - result = table; - - table.getColumnStatistic("col"); - result = new ColumnStatistic(1, 2, + new MockUp() { + @Mock + public Optional getColumnStatistic(String colName) { + return Optional.of(new ColumnStatistic(1, 2, null, 3, 4, 5, 6, 7, - null, null, false, null, new Date().toString(), null); + null, null, false, null, + new Date().toString(), null)); } }; + try { StatisticsCache statisticsCache = new StatisticsCache(); ColumnStatistic columnStatistic = statisticsCache.getColumnStatistics(1, 1, 1, "col");