You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/09/18 08:56:09 UTC

[GitHub] [shardingsphere] sccc803 opened a new issue #12553: Proxy returns wrong result when executing sql statement with subquery.

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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero edited a comment on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-922473282


   @sccc803 Hi, thanks for your detailed report. It's informative, nice.
   @strongduanmu could you check this one? 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-927571915


   @CrackerSuperior Hi, look forward. 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-926344538


   Hi @sccc803 @CrackerSuperior, can you help test whether the current subquery results correct?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-922494654


   Hi @sccc803, thank you for your feedback, I will check this problem.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-922473282


   @sccc803 Hi, thanks for your detailed report. 
   @strongduanmu could you check this one? 


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] CrackerSuperior commented on issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553#issuecomment-927248140


   > 嗨@sccc803 @CrackerSuperior,你能帮忙测试一下当前的子查询结果是否正确吗?
   
   Ok, I'll test it sometime.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero closed issue #12553: Proxy returns wrong result when executing sql statement with subquery.

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #12553:
URL: https://github.com/apache/shardingsphere/issues/12553


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org