BiteTheDDDDt commented on code in PR #65853: URL: https://github.com/apache/doris/pull/65853#discussion_r3673963214
########## fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilterPartitionColumnResolver.java: ########## @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.planner; + +import org.apache.doris.analysis.Expr; +import org.apache.doris.analysis.SlotRef; +import org.apache.doris.catalog.Column; +import org.apache.doris.catalog.OlapTable; + +import java.util.List; + +/** + * Resolves a selected-index column to its base-table partition column. + */ +public final class RuntimeFilterPartitionColumnResolver { + private RuntimeFilterPartitionColumnResolver() { + } + + /** + * Returns the matching partition-column ordinal, or -1 when the target is + * not a value-preserving representation of a base partition column. + */ + public static int findPartitionColumnIndex(OlapScanNode scanNode, Column targetColumn) { + if (targetColumn == null) { + return -1; + } + OlapTable table = scanNode.getOlapTable(); + List<Column> partitionColumns = table.getPartitionInfo().getPartitionColumns(); + if (targetColumn.isMaterializedViewColumn()) { Review Comment: Fixed in 9bddbeac739. The resolver now trusts an MV column defineExpr only when the selected index itself has a persisted MV definition statement. ADD ROLLUP ... FROM ... indexes have no defineStmt, so inherited SlotRef lineage is conservatively rejected even after DUP-key conversion clears SUM. I added classifier coverage for the cleared-marker case and an end-to-end BIGINT r_sum(sum_k) FROM mv_sum regression: forcing r_sum returns 1 / 13, with TotalPartitionsForRFPruning=0 and PartitionsPrunedByRuntimeFilter=0. Verified RuntimeFilterPartitionPruneClassifierTest (16/16), OlapScanNodeTest (7/7), and the query_p0/runtime_filter/rf_partition_pruning suite. -- 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]
