jackwener commented on code in PR #17983:
URL: https://github.com/apache/doris/pull/17983#discussion_r1143633920
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/PruneOlapScanTablet.java:
##########
@@ -51,18 +52,21 @@ public class PruneOlapScanTablet extends
OneRewriteRuleFactory {
@Override
public Rule build() {
return logicalFilter(logicalOlapScan())
- .when(filter -> !filter.child().isTabletPruned())
.then(filter -> {
LogicalOlapScan olapScan = filter.child();
OlapTable table = olapScan.getTable();
- List<Long> selectedTabletIds = Lists.newArrayList();
+ Builder<Long> selectedTabletIdsBuilder =
ImmutableList.builder();
for (Long id : olapScan.getSelectedPartitionIds()) {
Partition partition = table.getPartition(id);
MaterializedIndex index =
partition.getIndex(olapScan.getSelectedIndexId());
-
selectedTabletIds.addAll(getSelectedTabletIds(filter.getConjuncts(),
+
selectedTabletIdsBuilder.addAll(getSelectedTabletIds(filter.getConjuncts(),
index, partition.getDistributionInfo()));
}
- return
filter.withChildren(olapScan.withSelectedTabletIds(ImmutableList.copyOf(selectedTabletIds)));
+ List<Long> selectedTabletIds =
selectedTabletIdsBuilder.build();
+ if (new HashSet(selectedTabletIds).equals(new
HashSet(olapScan.getSelectedTabletIds()))) {
+ return null;
+ }
Review Comment:
Add this Check is enough, we don't need a flag to make Plan complex
--
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]