sccc803 opened a new issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553
### Which version of ShardingSphere did you use?
Master branch.
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy.
### Expected behavior
Here is a logic table called `sbtest` like this:
id | k | c | pad
-- | -- | -- | --
645998280928395264 | 0 | 0 | pad0
645998323827736577 | 1 | 0 | pad0
Execute a sql statement:
myslq > SELECT * FROM sbtest WHERE c = (SELECT c FROM sbtest WHERE k = 1);
Expected result rows:
id | k | c | pad
-- | -- | -- | --
645998280928395264 | 0 | 0 | pad0
645998323827736577 | 1 | 0 | pad0
### Actual behavior
Actual result rows:
id | k | c | pad
-- | -- | -- | --
645998323827736577 | 1 | 0 | pad0
It supposed to retrun 2 rows, but there is only 1 row.
### Reason analyze (If you can)
In this case , proxy uses the ShardingStandardRoutingEngine to route,
perhaps shoud use the ShardingFederatedRoutingEngine or some other one?
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
1. Set configurition file like this:
``` yaml
schemaName: sharding_db
dataSources:
ds_0:
url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useSSL=false
username: root
password: root
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 50
rules:
- !SHARDING
tables:
sbtest:
actualDataNodes: ds_0.sbtest_${0..1}
tableStrategy:
standard:
shardingColumn: k
shardingAlgorithmName: table_mod
keyGenerateStrategy:
column: id
keyGeneratorName: increment
shardingAlgorithms:
table_mod:
props:
sharding-count: 2
type: MOD
keyGenerators:
increment:
type: SNOWFLAKE
```
2. Create sbtest_0 , sbtest_1 on ds_0:
``` sql
CREATE TABLE `sbtest_xx` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`k` int(11) NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `k_1` (`k`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
3. Start up proxy, and execute insert statements:
``` sql
INSERT INTO sbtest (k,c,pad) VALUES (0,0,'pad0');
INSERT INTO sbtest (k,c,pad) VALUES (1,0,'pad0');
```
4. Execute the select stamentment and observing result:
``` sql
SELECT * FROM sbtest WHERE c = (SELECT c FROM sbtest WHERE k = 1);
```
### Example codes for reproduce this issue (such as a github link).
--
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]