englefly commented on code in PR #27893:
URL: https://github.com/apache/doris/pull/27893#discussion_r1412767064
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PruneOlapScanPartition.java:
##########
@@ -66,15 +68,21 @@ public Rule build() {
.stream()
.map(column ->
scanOutput.get(column.getName().toLowerCase()))
.collect(Collectors.toList());
+ List<Long> manuallySpecifiedPartitions =
scan.getManuallySpecifiedPartitions();
+ Map<Long, PartitionItem> idToPartitions;
+ if (manuallySpecifiedPartitions.isEmpty()) {
+ idToPartitions = partitionInfo.getIdToItem(false);
+ } else {
+ Map<Long, PartitionItem> allPartitions =
partitionInfo.getAllPartitions();
+ idToPartitions = allPartitions.keySet().stream()
+ .filter(id -> manuallySpecifiedPartitions.contains(id))
Review Comment:
如果 t1 是 temporary partition,那么 select * from t partitions(t1)会 报错,找不到t1:
partition 't1' doesn't exist
反之,如果t1是partition,那么 select * from t temporary partitions(t1) 也会 报错
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PruneOlapScanPartition.java:
##########
@@ -66,15 +68,21 @@ public Rule build() {
.stream()
.map(column ->
scanOutput.get(column.getName().toLowerCase()))
.collect(Collectors.toList());
+ List<Long> manuallySpecifiedPartitions =
scan.getManuallySpecifiedPartitions();
+ Map<Long, PartitionItem> idToPartitions;
+ if (manuallySpecifiedPartitions.isEmpty()) {
+ idToPartitions = partitionInfo.getIdToItem(false);
+ } else {
+ Map<Long, PartitionItem> allPartitions =
partitionInfo.getAllPartitions();
+ idToPartitions = allPartitions.keySet().stream()
+ .filter(id -> manuallySpecifiedPartitions.contains(id))
Review Comment:
如果 t1 是 temporary partition,那么 select * from t partitions(t1)会 报错,找不到t1:
partition 't1' doesn't exist
反之,如果t1是partition,那么 select * from t temporary partitions(t1) 也会 报错
--
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]