yunhwane opened a new pull request, #10662:
URL: https://github.com/apache/gravitino/pull/10662

   ### What changes were proposed in this pull request?
   
   - Replace the hardcoded `return 1` in 
`LancePartitionStatisticStorage.dropStatistics()` with an actual count of 
matching rows before deletion.
   - Change `dropStatisticsImpl` from `void` to `int`, using a 
`countMatchingRows()` helper that scans the Lance dataset to count matching 
rows before performing the delete.
   - Skip the delete operation entirely when no matching rows exist.
   
   ### Why are the changes needed?
   
   `LancePartitionStatisticStorage.dropStatistics()` always returned `1` as a 
hardcoded placeholder. `StatisticManager.dropPartitionStatistics()` converts 
this to a boolean via `!= 0`, so the REST API always reported a successful drop 
— even when:
   - The target partition does not exist
   - The statistic name does not exist
   - Nothing was actually deleted
   
   Fix: #10620
   
   ### Does this PR introduce _any_ user-facing change?
   
   The `DROP` partition statistics REST API now correctly returns `false` when 
no statistics were actually deleted, instead of always returning `true`.
   
   ### How was this patch tested?
   
   - Updated existing tests in `TestLancePartitionStatisticStorage` to verify 
the return value of `dropStatistics()` (1 for single drop, 2 for 
multi-partition drop).
   - Added a new test case that drops non-existent statistics and asserts the 
return value is `0`.
   - All existing tests continue to pass: `./gradlew :core:test --tests 
"org.apache.gravitino.stats.storage.TestLancePartitionStatisticStorage"`


-- 
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]

Reply via email to