diff --git a/paimon-common/src/main/java/org/apache/paimon/utils/MathUtils.java b/paimon-common/src/main/java/org/apache/paimon/utils/MathUtils.java index 5a71a90c3786..c50646bd266e 100644 --- a/paimon-common/src/main/java/org/apache/paimon/utils/MathUtils.java +++ b/paimon-common/src/main/java/org/apache/paimon/utils/MathUtils.java @@ -95,10 +95,10 @@ public static Integer min(Integer v1, Integer v2) { } /** Safely increments the given int value by one, ensuring that no overflow occurs. */ - public static int incrementSafely(int value) { - if (value < Integer.MAX_VALUE) { - return value + 1; + public static int incrementSafely(int a) { + if (a == Integer.MAX_VALUE) { + return a; } - return value; + return a + 1; } }