github-actions[bot] commented on code in PR #69678:
URL: https://github.com/apache/doris/pull/69678#discussion_r4396954833


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SortedPartitionRanges.java:
##########
@@ -85,6 +86,28 @@ public static <K> SortedPartitionRanges<K> build(Map<K, 
PartitionItem> partition
         return new SortedPartitionRanges<>(sortedRanges, defaultPartitions);
     }
 
+    /**
+     * Keep only the entries whose partition id is present in {@code 
partitionIds}.
+     */
+    public SortedPartitionRanges<K> restrictTo(Set<K> partitionIds) {
+        Objects.requireNonNull(partitionIds, "partitionIds can not be null");
+        List<PartitionItemAndRange<K>> restrictedRanges
+                = Lists.newArrayListWithCapacity(sortedPartitions.size());

Review Comment:
   [P2] Build reduced pruning indexes from the retained partitions
   
   Consider `Join(Filter(f.dt IN (p1,p2), F), Filter(d.k=1, D))`, where a join 
MV is partitioned on F, p1 is stale, p2 is valid/nonempty, and D has N 
enumerated partitions but already retains only k=1. 
`StructInfo.addFilterOnTableScan` invalidates both scans, so the unchanged 
dimension is re-pruned. Since pruning results do not retain a sorted index, it 
fetches D's full pinned index, then this method walks all N ranges and reserves 
N reference slots to keep one entry. Every compensated candidate repeats that 
full-table work/allocation, adding O(M*N) work across M candidates despite a 
singleton dimension selection. The index is already cached, so its initial 
construction does not require this repeated traversal. Build the re-pruning 
index from the retained map (or prune that small map sequentially), or retain a 
subset index so work and temporary allocation scale with the retained 
selection. This is a separate performance regression from the repaired 
index/selection mismatch in thread 
 4386524923.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to