This is an automated email from the ASF dual-hosted git repository.
yangsiyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 281e13de906 [fix](inverted index) check policy type when dropping
index policy (#59132)
281e13de906 is described below
commit 281e13de9069e14bae153afff06e797aa31fb97f
Author: zzzxl <[email protected]>
AuthorDate: Fri Dec 19 10:30:15 2025 +0800
[fix](inverted index) check policy type when dropping index policy (#59132)
---
.../apache/doris/indexpolicy/IndexPolicyMgr.java | 4 +++
.../test_index_policy_drop.groovy | 36 ++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/indexpolicy/IndexPolicyMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/indexpolicy/IndexPolicyMgr.java
index 49f6ac985e5..b6c16668f8c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/indexpolicy/IndexPolicyMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/indexpolicy/IndexPolicyMgr.java
@@ -408,6 +408,10 @@ public class IndexPolicyMgr implements Writable,
GsonPostProcessable {
}
throw new DdlException("index policy " + indexPolicyName + "
does not exist");
}
+ if (policyToDrop.getType() != type) {
+ throw new DdlException("Cannot drop " + policyToDrop.getType()
+ " policy '"
+ + indexPolicyName + "' by DROP " + type + "
statement.");
+ }
if (policyToDrop.getType() == IndexPolicyTypeEnum.ANALYZER) {
checkAnalyzerNotUsedByIndex(policyToDrop.getName());
} else if (policyToDrop.getType() ==
IndexPolicyTypeEnum.NORMALIZER) {
diff --git
a/regression-test/suites/inverted_index_p0/test_index_policy_drop.groovy
b/regression-test/suites/inverted_index_p0/test_index_policy_drop.groovy
new file mode 100644
index 00000000000..fc2f355cb28
--- /dev/null
+++ b/regression-test/suites/inverted_index_p0/test_index_policy_drop.groovy
@@ -0,0 +1,36 @@
+// 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.
+
+suite("test_index_policy_drop") {
+ def tokenizerName = "test_tokenizer_drop_check"
+
+ // 1. Create a tokenizer policy
+ sql "DROP INVERTED INDEX TOKENIZER IF EXISTS ${tokenizerName}"
+ sql """
+ CREATE INVERTED INDEX TOKENIZER ${tokenizerName}
+ PROPERTIES("type" = "pinyin")
+ """
+
+ // 2. Attempt to drop it using DROP ANALYZER syntax (should fail)
+ test {
+ sql "DROP INVERTED INDEX ANALYZER ${tokenizerName}"
+ exception "Cannot drop TOKENIZER policy '${tokenizerName}' by DROP
ANALYZER statement"
+ }
+
+ // 3. Drop it using correct syntax (should succeed)
+ sql "DROP INVERTED INDEX TOKENIZER ${tokenizerName}"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]