Skip to content

Commit 6b8c90b

Browse files
committed
[test](fe) Fix score table type unit test
### What problem does this PR solve? Issue Number: close #66547 Related PR: #66973 Problem Summary: The score table type unit test ran the complete rewrite pipeline on empty mock tables. Empty-relation pruning removed the OLAP scans before the late CheckScoreUsage rule ran, so the AGG_KEYS and merge-on-read UNIQUE_KEYS assertions incorrectly observed no exception. Apply CheckScoreUsage directly to the analyzed plan so the unit test targets the rule under test. Remove unrelated supported-table assertions that require the complete score optimization rule sequence and are covered by existing score tests. ### Release note None ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.nereids.rules.analysis.CheckScoreTableTypeTest - Behavior changed: No - Does this need documentation: No
1 parent 6749ee2 commit 6b8c90b

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

‎fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/CheckScoreTableTypeTest.java‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.doris.nereids.rules.analysis;
1919

2020
import org.apache.doris.nereids.exceptions.AnalysisException;
21+
import org.apache.doris.nereids.rules.rewrite.CheckScoreUsage;
2122
import org.apache.doris.nereids.util.PlanChecker;
2223
import org.apache.doris.utframe.TestWithFeService;
2324

@@ -43,15 +44,6 @@ protected void runBeforeAll() throws Exception {
4344
+ "UNIQUE KEY(k1, content) DISTRIBUTED BY HASH(k1) BUCKETS 1 "
4445
+ "PROPERTIES ('replication_num' = '1', "
4546
+ "'enable_unique_key_merge_on_write' = 'false')");
46-
createTable("CREATE TABLE mow_table ("
47-
+ "k1 INT, content VARCHAR(255), INDEX idx_content(content) USING INVERTED) "
48-
+ "UNIQUE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 1 "
49-
+ "PROPERTIES ('replication_num' = '1', "
50-
+ "'enable_unique_key_merge_on_write' = 'true')");
51-
createTable("CREATE TABLE dup_table ("
52-
+ "k1 INT, content VARCHAR(255), INDEX idx_content(content) USING INVERTED) "
53-
+ "DUPLICATE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 1 "
54-
+ "PROPERTIES ('replication_num' = '1')");
5547
}
5648

5749
@Test
@@ -64,12 +56,6 @@ public void testRejectScoreOnMorTable() {
6456
assertScoreRejected("mor_table");
6557
}
6658

67-
@Test
68-
public void testAllowScoreOnSupportedTableTypes() {
69-
Assertions.assertDoesNotThrow(() -> analyzeScoreQuery("mow_table"));
70-
Assertions.assertDoesNotThrow(() -> analyzeScoreQuery("dup_table"));
71-
}
72-
7359
private void assertScoreRejected(String tableName) {
7460
AnalysisException exception = Assertions.assertThrows(
7561
AnalysisException.class, () -> analyzeScoreQuery(tableName));
@@ -78,6 +64,7 @@ private void assertScoreRejected(String tableName) {
7864

7965
private void analyzeScoreQuery(String tableName) {
8066
PlanChecker.from(connectContext).analyze("SELECT score() AS s FROM " + tableName
81-
+ " WHERE content MATCH 'doris' ORDER BY s LIMIT 10").rewrite();
67+
+ " WHERE content MATCH 'doris' ORDER BY s LIMIT 10")
68+
.applyTopDown(new CheckScoreUsage());
8269
}
8370
}

0 commit comments

Comments
 (0)