This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch feature/mor_value_predicate_pushdown_control in repository https://gitbox.apache.org/repos/asf/doris.git
commit 1c6db7775dde85d603a2291fda9366d1e3fb8ed2 Author: Yongqiang YANG <[email protected]> AuthorDate: Tue Mar 3 19:33:26 2026 -0800 [fix](scan) Refactor table list matching to use TableNameInfo-style component parsing Address review feedback: replace naive string concatenation matching with component-based parsing (split by ".") consistent with TableNameInfo, fixing null dbName handling and empty entry edge cases. Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../java/org/apache/doris/qe/SessionVariable.java | 58 +++++++++++----------- .../nereids/rules/analysis/ReadMorAsDupTest.java | 2 +- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 42aef65243d..71dc247469a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -4794,43 +4794,45 @@ public class SessionVariable implements Serializable, Writable { return enableMorValuePredicatePushdownTables; } - /** - * Check if a table is enabled for MOR value predicate pushdown. - * @param dbName database name - * @param tableName table name - * @return true if the table is in the enabled list or if '*' is set - */ public boolean isMorValuePredicatePushdownEnabled(String dbName, String tableName) { - if (enableMorValuePredicatePushdownTables == null - || enableMorValuePredicatePushdownTables.isEmpty()) { - return false; - } - String trimmed = enableMorValuePredicatePushdownTables.trim(); - if ("*".equals(trimmed)) { - return true; - } - String fullName = dbName + "." + tableName; - for (String table : trimmed.split(",")) { - if (table.trim().equalsIgnoreCase(fullName) - || table.trim().equalsIgnoreCase(tableName)) { - return true; - } - } - return false; + return isTableInList(enableMorValuePredicatePushdownTables, dbName, tableName); } public boolean isReadMorAsDupEnabled(String dbName, String tableName) { - if (readMorAsDupTables == null || readMorAsDupTables.isEmpty()) { + return isTableInList(readMorAsDupTables, dbName, tableName); + } + + /** + * Check if a table matches any entry in a comma-separated table list. + * Parses entries the same way as TableNameInfo: split by "." to extract + * component parts (table, db.table, or ctl.db.table). + * When entry specifies db, both db and table must match. + * When entry is just a table name, it matches any database. + */ + private static boolean isTableInList(String tableList, String dbName, String tableName) { + if (tableList == null || tableList.isEmpty()) { return false; } - String trimmed = readMorAsDupTables.trim(); + String trimmed = tableList.trim(); if ("*".equals(trimmed)) { return true; } - String fullName = dbName + "." + tableName; - for (String table : trimmed.split(",")) { - if (table.trim().equalsIgnoreCase(fullName) - || table.trim().equalsIgnoreCase(tableName)) { + for (String entry : trimmed.split(",")) { + String trimmedEntry = entry.trim(); + if (trimmedEntry.isEmpty()) { + continue; + } + String[] parts = trimmedEntry.split("\\."); + String entryTbl = parts[parts.length - 1]; + String entryDb = parts.length >= 2 ? parts[parts.length - 2] : null; + if (!entryTbl.equalsIgnoreCase(tableName)) { + continue; + } + if (entryDb != null) { + if (dbName != null && entryDb.equalsIgnoreCase(dbName)) { + return true; + } + } else { return true; } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/ReadMorAsDupTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/ReadMorAsDupTest.java index 579ae3c527f..1c3f687c8ab 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/ReadMorAsDupTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/ReadMorAsDupTest.java @@ -227,7 +227,7 @@ class ReadMorAsDupTest extends TestWithFeService implements GeneratedPlanPattern connectContext.getSessionVariable().isReadMorAsDupEnabled("mydb", "mytbl")); Assertions.assertFalse( connectContext.getSessionVariable().isReadMorAsDupEnabled("otherdb", "othertbl")); - // "mydb.mytbl" entry only matches full name or exact table name "mydb.mytbl" + // "mydb.mytbl" entry requires both db and table components to match Assertions.assertFalse( connectContext.getSessionVariable().isReadMorAsDupEnabled("anything", "mytbl")); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
