thswlsqls opened a new issue, #39857:
URL: https://github.com/apache/shardingsphere/issues/39857

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master @ 101c3d56ccd
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Both
   
   ### Expected behavior
   Error 20023 reports the stop offset first and the start offset second, as 
documented in 
`docs/document/content/user-manual/error-code/sql-error-code.en.md` line 174. 
With `start-offset: 10`, `stop-offset: 1` and sharding value `1`:
   
   ```
   Sharding value 1 subtract stop offset 1 can not be less than start offset 10.
   ```
   
   ### Actual behavior
   The two offsets are swapped: `Sharding value 1 subtract stop offset 10 can 
not be less than start offset 1.`
   
   ### Reason analyze (If you can)
   `ShardingValueOffsetException` 
(`features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/data/ShardingValueOffsetException.java`
 line 31) passes `startOffset, stopOffset` to a format string whose 
placeholders are ordered stop first, start second. The only caller, 
`ModShardingAlgorithm.cutShardingValue()` line 141, passes arguments in 
declared order, so only the `super` call is wrong.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   Configure a `MOD` sharding algorithm with `start-offset` plus `stop-offset` 
not less than the sharding value length, then route a query with that value. 
The client receives SQLState `44000`, vendor code `20023`.
   
   ### Example codes for reproduce this issue (such as a github link).
   N/A
   
   


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