morrySnow commented on code in PR #24186: URL: https://github.com/apache/doris/pull/24186#discussion_r1322510889
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java: ########## @@ -76,14 +78,23 @@ public static List<Long> prune(List<Slot> partitionSlots, Expression partitionPr partitionPredicate = TryEliminateUninterestedPredicates.rewrite( partitionPredicate, ImmutableSet.copyOf(partitionSlots), cascadesContext); + Set<Long> defaultPartitionIds = Sets.newHashSet(); List<OnePartitionEvaluator> evaluators = idToPartitions.entrySet() .stream() + .peek(kv -> { + if (kv.getValue().isDefaultPartition()) { + defaultPartitionIds.add(kv.getKey()); + } + }) .map(kv -> toPartitionEvaluator(kv.getKey(), kv.getValue(), partitionSlots, cascadesContext, partitionTableType)) .collect(ImmutableList.toImmutableList()); PartitionPruner partitionPruner = new PartitionPruner(evaluators, partitionPredicate); - return partitionPruner.prune(); + //TODO: we keep default partition because it's too hard to prune it. + Set<Long> prunedPartition = Sets.newHashSet(partitionPruner.prune()); Review Comment: why not change partitionPruner itself, to let it return correct set ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java: ########## @@ -76,14 +78,23 @@ public static List<Long> prune(List<Slot> partitionSlots, Expression partitionPr partitionPredicate = TryEliminateUninterestedPredicates.rewrite( partitionPredicate, ImmutableSet.copyOf(partitionSlots), cascadesContext); + Set<Long> defaultPartitionIds = Sets.newHashSet(); List<OnePartitionEvaluator> evaluators = idToPartitions.entrySet() .stream() + .peek(kv -> { + if (kv.getValue().isDefaultPartition()) { + defaultPartitionIds.add(kv.getKey()); + } + }) .map(kv -> toPartitionEvaluator(kv.getKey(), kv.getValue(), partitionSlots, cascadesContext, partitionTableType)) .collect(ImmutableList.toImmutableList()); PartitionPruner partitionPruner = new PartitionPruner(evaluators, partitionPredicate); - return partitionPruner.prune(); + //TODO: we keep default partition because it's too hard to prune it. + Set<Long> prunedPartition = Sets.newHashSet(partitionPruner.prune()); Review Comment: use `ImmutableSet.Builder`, add defaultPartitionId to this builder directly -- 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