[Improvement] Lance partition statistics drop API reports success even when nothing is deleted
#10,620 opened on Apr 1, 2026
Repository metrics
- Stars
- (3,058 stars)
- PR merge metrics
- (PR metrics pending)
Description
What would you like to be improved?
When Gravitino is configured to use org.apache.gravitino.stats.storage.LancePartitionStatisticStorageFactory for partition statistics storage, dropping partition statistics can return success even if no statistics were actually removed.
In LancePartitionStatisticStorage.java, dropStatistics(...) always returns 1 as a placeholder:
That value is later converted to a boolean in StatisticManager.java, where != 0 becomes true, and the REST API returns DropResponse(true).
This means clients can get a successful drop result even when:
- the target partition does not exist
- the statistic name does not exist
- nothing was actually deleted
How should we improve?
Do not return a hard-coded success count from the Lance backend.
Possible fixes:
- Change the Lance dropStatistics(...) contract so it returns an accurate deleted count.
- If Lance cannot provide counts, change the higher-level API to avoid interpreting a placeholder count as success.
- As a safe short-term fix, have the Lance path return 0 only when the request is empty and otherwise explicitly verify whether matching rows existed before deletion, then return a real count or a trustworthy boolean.