feat(index): support dry_run in drop_global_index#489
Conversation
fe064d2 to
73d6c02
Compare
|
I found one correctness issue compared with the Java implementation. Java/Flink and Java/Spark entry.indexFile().globalIndexMeta().getIndexedFieldIds().equals(indexFieldIds)That means the primary index field plus In this PR, if global_meta.index_field_id != index_field.id() {
continue;
}So if there are two global index files with the same primary field but different CALL sys.drop_global_index(table => 'db.t', index_column => 'id', dry_run => true)will count both files, and a real drop would delete both. Java would only match the I verified this locally by adding a temporary test with two BTree index files:
The dry run returned Could you update the drop matching logic to compare the full indexed field ids, i.e. |
Purpose
Add
dry_runtodrop_global_index, matching Java's apache/paimon#8309. A dry run reports how many global index files a drop would remove, committing nothing — a safety preview before the irreversible metadata commit. Because it lives in the sharedGlobalIndexDropBuilder, it covers all supported types (btree/bitmap/lumina/vindex) in one change.Changes
GlobalIndexDropBuilder: newwith_dry_run(bool);execute()still returns the matched count (usize), but on dry-run short-circuits before the commit, so nothing is written. The non-dry-run path is unchanged.sys.drop_global_index: parses thedry_runarg (true/false, case-insensitive; invalid → error), and on dry-run returnsWould drop N global index file(s)instead of committing.Out of scope
partitionsremainsNotImplemented(separate follow-up).Tests
drop_global_index(... dry_run => true)leaves$table_indexesunchanged, then a real drop empties it; invaliddry_runvalue is rejected.