feiniaofeiafei commented on code in PR #44586: URL: https://github.com/apache/doris/pull/44586#discussion_r1866951021
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PruneOlapScanPartition.java: ########## @@ -76,10 +81,18 @@ public Rule build() { partitionSlots.add(partitionSlot); } } + NereidsSortedPartitionsCacheManager sortedPartitionsCacheManager = Env.getCurrentEnv() + .getSortedPartitionsCacheManager(); List<Long> manuallySpecifiedPartitions = scan.getManuallySpecifiedPartitions(); - Map<Long, PartitionItem> idToPartitions; + Map<Long, PartitionItem> idToPartitions = ImmutableMap.of(); + SortedPartitionRanges<Long> sortedPartitionRanges = null; if (manuallySpecifiedPartitions.isEmpty()) { - idToPartitions = partitionInfo.getIdToItem(false); + Optional<SortedPartitionRanges<?>> sortedPartitionRangesOpt = sortedPartitionsCacheManager.get(table); + if (sortedPartitionRangesOpt.isPresent()) { + sortedPartitionRanges = (SortedPartitionRanges<Long>) sortedPartitionRangesOpt.get(); + } else { + idToPartitions = partitionInfo.getIdToItem(false); + } Review Comment: when sortedPartitionRangesOpt.isPresent(), idToPartitions will be empty map, in PartitionPruner.prune, may lead to result wrong when BooleanLiteral.TRUE.equals(partitionPredicate) is true. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org