RaigorJiang opened a new issue, #33341:
URL: https://github.com/apache/shardingsphere/issues/33341
## Bug Report
### Which version of ShardingSphere did you use?
5.5.1-SNAPSHOT f205426bca54a4f784912ae7d1ae5b193a17cf56
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
Sharding routing is correct
### Actual behavior
Exception occurs
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
1. create database
```sql
CREATE DATABASE sharding_db;
USE sharding_db;
REGISTER STORAGE UNIT ds_0 (
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10)
), ds_1 (
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10)
), ds_2 (
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_2?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10)
), ds_3 (
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_3?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10)
);
```
2. create sharding table
```sql
CREATE SHARDING TABLE RULE t_order (
DATANODES("ds_${0}.t_order_${0..3},ds_${1}.t_order_${4..7},ds_${2}.t_order_${8..11},ds_${3}.t_order_${12..15}"),
DATABASE_STRATEGY(
TYPE="STANDARD",
SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(
TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${(order_id % 16 / 4)
as int}","allow-range-query-with-inline-sharding"=true)))
),
TABLE_STRATEGY(
TYPE="STANDARD",
SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(
TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_${order_id %
16}","allow-range-query-with-inline-sharding"=true)))
)
);
DROP TABLE IF EXISTS t_order;
CREATE TABLE `t_order` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT 'order id',
PRIMARY KEY (`id`)
);
```
3. execute preview or select
```sql
preview select * from t_order WHERE order_id IN (768017);
preview select * from t_order WHERE order_id IN (400037);
preview select * from t_order WHERE order_id IN (768017,400037);
```
<img width="1156" alt="image"
src="https://github.com/user-attachments/assets/8717d916-2b63-4a1d-aaa9-9827ba9f76fa">
--
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]