thswlsqls opened a new issue, #39861: URL: https://github.com/apache/shardingsphere/issues/39861
## Bug Report ### Which version of ShardingSphere did you use? master @ 101c3d56ccd ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? Both ### Expected behavior A one-sided range (`<`, `<=`, `>`, `>=`) on an INTERVAL sharding column outside `datetime-lower`/`datetime-upper` routes like the equivalent closed range: empty, or the overlapping slot tables. ### Actual behavior Raw `java.lang.IllegalArgumentException: Invalid range: [2021-06-01T00:00..2021-05-01T00:00)` from Guava, while the same closed range returns an empty set and `AUTO_INTERVAL` clamps without throwing. ### Reason analyze (If you can) `IntervalShardingAlgorithm.hasIntersection()` (`features/sharding/core`, line 160-168) substitutes `datetime-lower`/`datetime-upper` for the missing endpoint and calls `Range.range(lower, ..., upper, ...)`; outside the window lower > upper and Guava rejects it. The substitution also turns `> datetime-upper` into an empty range, silently skipping the last slot table. ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 1. `INTERVAL` with `datetime-pattern=yyyy-MM-dd HH:mm:ss`, `datetime-lower=2021-06-01 00:00:00`, `datetime-upper=2021-07-31 00:00:00`, `sharding-suffix-pattern=yyyyMMdd`, `datetime-interval-amount=2`. 2. `SELECT * FROM t_order WHERE create_time < '2021-05-01 00:00:00';` or `create_time >= '2021-08-02 00:00:00'` -> `IllegalArgumentException`. 3. With `datetime-upper` omitted (defaults to startup time), `create_time > '<after startup>'` fails too. ### 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]
