This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6cdae7860d5 Fix swapped offset arguments in sharding value offset 
error message (#39858)
6cdae7860d5 is described below

commit 6cdae7860d510752e465d0dbbd28b728cad6d6c2
Author: Eunbin Son <[email protected]>
AuthorDate: Tue Sep 22 23:09:01 2026 +0900

    Fix swapped offset arguments in sharding value offset error message (#39858)
    
    Co-authored-by: Liang Zhang <[email protected]>
---
 RELEASE-NOTES.md                                                  | 1 +
 .../sharding/exception/data/ShardingValueOffsetException.java     | 2 +-
 .../sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java | 8 ++++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 2d29ec08451..91a67baa0a0 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -86,6 +86,7 @@
 1. Sharding: Compute the Snowflake key generator epoch in UTC instead of the 
JVM default timezone - 
[#38932](https://github.com/apache/shardingsphere/pull/38932)
 1. Sharding: Fix order-dependent data source intersection in Cartesian routing 
- [#39407](https://github.com/apache/shardingsphere/pull/39407)
 1. Sharding: Fix incorrect AVG(DISTINCT) merge result across shards - 
[#39429](https://github.com/apache/shardingsphere/pull/39429)
+1. Sharding: Fix swapped start and stop offset in sharding value offset error 
message - [#39858](https://github.com/apache/shardingsphere/pull/39858)
 1. Sharding: Fix sharding constraint reviser removing every actual table 
suffix - [#39868](https://github.com/apache/shardingsphere/pull/39868)
 1. Sharding: Fix DISABLE_AUDIT_NAMES hint ignoring auditor name case - 
[#39871](https://github.com/apache/shardingsphere/pull/39871)
 1. Readwrite-splitting: Evaluate inline expressions in data source names of 
rule configuration checker - 
[#39374](https://github.com/apache/shardingsphere/pull/39374)
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/data/ShardingValueOffsetException.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/data/ShardingValueOffsetException.java
index ddb44795e90..2c9fc0bdbb0 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/data/ShardingValueOffsetException.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/data/ShardingValueOffsetException.java
@@ -28,6 +28,6 @@ public final class ShardingValueOffsetException extends 
ShardingSQLException {
     private static final long serialVersionUID = 734610922729978886L;
     
     public ShardingValueOffsetException(final Comparable<?> shardingValue, 
final int startOffset, final int stopOffset) {
-        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 23, "Sharding value %s 
subtract stop offset %d can not be less than start offset %d.", shardingValue, 
startOffset, stopOffset);
+        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 23, "Sharding value %s 
subtract stop offset %d can not be less than start offset %d.", shardingValue, 
stopOffset, startOffset);
     }
 }
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
index 84adc328823..db846c61427 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
@@ -34,6 +34,7 @@ import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 
+import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Properties;
@@ -71,10 +72,13 @@ class ModShardingAlgorithmTest {
     void assertPreciseDoShardingWhenOffsetOverload() {
         ModShardingAlgorithm algorithm = (ModShardingAlgorithm) 
TypedSPILoader.getService(ShardingAlgorithm.class, "MOD",
                 PropertiesBuilder.build(new Property("sharding-count", "16"), 
new Property("start-offset", "10"), new Property("stop-offset", "1")));
-        assertThrows(ShardingValueOffsetException.class, () -> 
algorithm.doSharding(
+        SQLException actual = assertThrows(ShardingValueOffsetException.class, 
() -> algorithm.doSharding(
                 Arrays.asList("t_order_8", "t_order_9", "t_order_10", 
"t_order_11", "t_order_12", "t_order_13", "t_order_14", "t_order_15",
                         "t_order_0", "t_order_1", "t_order_2", "t_order_3", 
"t_order_4", "t_order_5", "t_order_6", "t_order_7"),
-                new PreciseShardingValue<>("t_order", "order_id", 
DATA_NODE_INFO, "1")));
+                new PreciseShardingValue<>("t_order", "order_id", 
DATA_NODE_INFO, "1"))).toSQLException();
+        assertThat(actual.getErrorCode(), is(20023));
+        assertThat(actual.getSQLState(), is("44000"));
+        assertThat(actual.getMessage(), is("Sharding value 1 subtract stop 
offset 1 can not be less than start offset 10."));
     }
     
     @SuppressWarnings("unchecked")

Reply via email to