airborne12 commented on code in PR #70352:
URL: https://github.com/apache/doris/pull/70352#discussion_r4731454795
##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -2179,37 +2201,75 @@ public int getAsInt() {
buildIndexChange = true;
lightSchemaChange = false;
} else if (alterClause instanceof DropIndexClause) {
- if (processDropIndex((DropIndexClause) alterClause,
olapTable, newIndexes)) {
- return;
- }
- lightSchemaChange = false;
-
DropIndexClause dropIndexClause = (DropIndexClause)
alterClause;
- List<Index> existedIndexes = olapTable.getIndexes();
- Index found = null;
- for (Index existedIdx : existedIndexes) {
- if
(existedIdx.getIndexName().equalsIgnoreCase(dropIndexClause.getIndexName())) {
- found = existedIdx;
- break;
+
+ if (dropIndexClause.hasPartitionSpec()) {
+ // Delete the physical index files and keep the
table-level index definition.
+ List<Index> existedIndexes = olapTable.getIndexes();
+ Index found = null;
+ for (Index existedIdx : existedIndexes) {
+ if
(existedIdx.getIndexName().equalsIgnoreCase(dropIndexClause.getIndexName())) {
+ found = existedIdx;
+ break;
+ }
}
- }
- // for inverted index, light schema change is supported in
both cloud and local mode;
- // for ngram index, light schema change is supported only
in cloud mode;
- boolean supportLightIndexChange = false;
- if (Config.isCloudMode()) {
- if (enableAddIndexForNewData) {
- supportLightIndexChange = (
- found.getIndexType() == IndexType.NGRAM_BF
- || found.getIndexType() ==
IndexDef.IndexType.INVERTED);
+ if (found == null) {
+ if (dropIndexClause.isSetIfExists()) {
+ LOG.info("drop index[{}] which does not exist
on table[{}]",
+ dropIndexClause.getIndexName(),
olapTable.getName());
+ return;
+ }
+ throw new DdlException("index " +
dropIndexClause.getIndexName() + " does not exist");
}
- } else {
- supportLightIndexChange = found.getIndexType() ==
IndexDef.IndexType.INVERTED
- || found.getIndexType() ==
IndexDef.IndexType.ANN;
- }
- if (found != null && supportLightIndexChange) {
+ if (found.getIndexType() != IndexType.INVERTED) {
Review Comment:
Confirmed and reproduced on master (shared-nothing): `DROP INDEX idx_v ON t
PARTITION (p1)` reached FINISHED, but the rewritten p1 rowset still had `idx_v`
in its schema with an `.idx` file of the same size, and a MATCH on p1 with
`enable_match_without_inverted_index = false` still used the index (a STRING
index dropped the same way was gone). Fixed on master in #71122: DROP INDEX ON
PARTITION now rejects any index on a VARIANT column, `field_pattern` indexes
included, as BUILD INDEX does. Picked here as 7ca3a043a0b, with the FE unit
test and case 11 of `test_drop_index_on_partition`.
--
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]