From c57505e8881de7d113381649f1719360e5690243 Mon Sep 17 00:00:00 2001 From: 924060929 Date: Mon, 23 Dec 2024 16:27:56 +0800 Subject: [PATCH] fix --- .../cache/NereidsSortedPartitionsCacheManager.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSortedPartitionsCacheManager.java b/fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSortedPartitionsCacheManager.java index d13b91e15fb6fc..499c3b46709578 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSortedPartitionsCacheManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSortedPartitionsCacheManager.java @@ -45,7 +45,13 @@ import java.util.Map.Entry; import java.util.Optional; -/** NereidsSortedPartitionsCacheManager */ +/** + * This cache is used to sort the table partitions by range, so we can do binary search to skip + * filter the huge numbers of partitions, for example, the table partition column is `dt date` + * and one date for one partition, range from '2017-01-01' to '2025-01-01', for partition predicate + * `where dt = '2024-12-24'`, we can fast jump to '2024-12-24' within few partition range comparison, + * and the QPS can be improved + */ public class NereidsSortedPartitionsCacheManager { private volatile Cache partitionCaches; @@ -74,7 +80,7 @@ public Optional> get(OlapTable table) { if (table.getId() != partitionCacheContext.tableId || table.getVisibleVersion() != partitionCacheContext.tableVersion) { partitionCaches.invalidate(key); - return Optional.empty(); + return Optional.of(loadCache(key, table)); } return Optional.of(partitionCacheContext.sortedPartitionRanges); }