This is an automated email from the ASF dual-hosted git repository.
yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new ac7fa6c0a3 [#7521] fix(common): Fix precondition message mismatch
(#7525)
ac7fa6c0a3 is described below
commit ac7fa6c0a3c3fd8d29464ad7520edb403844c8e8
Author: fad <[email protected]>
AuthorDate: Tue Jul 1 22:33:31 2025 +0900
[#7521] fix(common): Fix precondition message mismatch (#7525)
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): support xxx"
- "[#233] fix: check null before access result in xxx"
- "[MINOR] refactor: fix typo in variable name"
- "[MINOR] docs: fix typo in README"
- "[#255] test: fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### What changes were proposed in this pull request?
Update the error message in Preconditions.checkState to match the
validation logic.
This change ensures that the error message accurately reflects the
status being checked by the code.
### Why are the changes needed?
Previously, the validation logic allowed values greater than or equal to
-1, but the error message stated that only values greater than -1 were
acceptable. This could mislead users or developers.
Fix: #7521
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Local verification.
---
common/src/main/java/org/apache/gravitino/dto/rel/DistributionDTO.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/common/src/main/java/org/apache/gravitino/dto/rel/DistributionDTO.java
b/common/src/main/java/org/apache/gravitino/dto/rel/DistributionDTO.java
index 1d6887af09..3b50042397 100644
--- a/common/src/main/java/org/apache/gravitino/dto/rel/DistributionDTO.java
+++ b/common/src/main/java/org/apache/gravitino/dto/rel/DistributionDTO.java
@@ -164,7 +164,7 @@ public class DistributionDTO implements Distribution {
Preconditions.checkState(args != null, "expressions cannot be null");
// Check if the number of buckets is greater than -1, -1 is auto.
- Preconditions.checkState(number >= -1, "bucketNum must be greater than
-1");
+ Preconditions.checkState(number >= -1, "bucketNum must be greater than
or equal -1");
return new DistributionDTO(strategy, number, args);
}
}