airborne12 opened a new pull request, #62181:
URL: https://github.com/apache/doris/pull/62181
### What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
Currently, `DROP INDEX` only supports table-level operations — it removes
both the index metadata and physical index files across all partitions. In
contrast, `BUILD INDEX` already supports partition-level operations via `BUILD
INDEX ON PARTITION`.
This PR adds the corresponding inverse operation: `DROP INDEX ON PARTITION`,
which deletes only the physical inverted index files on specified partitions
while preserving the table-level index definition. This is useful for:
- Cleaning up index data on specific partitions to reclaim storage space
- Selectively removing indexes from cold/archive partitions while keeping
them on hot partitions
**Syntax:**
```sql
-- Standalone form
DROP INDEX [IF EXISTS] idx_name ON table_name PARTITIONS (p1, p2, ...);
-- ALTER TABLE form
ALTER TABLE table_name DROP INDEX [IF EXISTS] idx_name PARTITION (p1);
```
**Key design decisions:**
- Only inverted indexes are supported (other index types are rejected)
- Table-level index metadata is NOT modified — the index definition remains
in the schema
- Queries on affected partitions automatically fallback to non-index scan
via `enable_fallback_on_missing_inverted_index` (default: true)
- Works in both storage-compute separation (cloud) and storage-compute
integrated (local) modes
- No BE-side or cloud meta service changes required — reuses existing
`IndexChangeJob` and `buildOrDeleteTableInvertedIndices` infrastructure
### Release note
Support `DROP INDEX ON PARTITION` for inverted indexes, allowing users to
delete physical index files on specified partitions without removing the
table-level index definition.
### Check List (For Author)
- Test
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
- Behavior changed:
- [x] Yes. Added new SQL syntax `DROP INDEX ... PARTITION/PARTITIONS
(...)` that was previously not supported. Existing `DROP INDEX` behavior
without partition spec is unchanged.
- Does this need documentation?
- [x] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]