xue2lang opened a new issue #8152:
URL: https://github.com/apache/shardingsphere/issues/8152


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.1.1 
   
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   
   ### Expected behavior
   database: db0,db1
   table:tb_0,tb_1  (every database has two table)
   shardingColumn: id  (database and table all use it)
   sql:select * from tb where id in (a,b)
   
   ShardingConditions: id in (a,b)
   id=a is in db0.tb0
   id=b is in db1.tb1
   
   
   expect:
   
   select * from db0.tb0 in (a,b)   # will be better: select * from db0.tb0 in 
(a);
   select * from db1.tb1 in (a,b)   #  will be better:  select * from db1.tb1 
in (b)
   
   ### Actual behavior
   
   sql behavior is cartesian set
   
   eg:
   select * from db0.tb0 in (a,b)
   select * from db0.tb1 in (a,b)
   select * from db1.tb0 in (a,b)
   select * from db1.tb1 in (a,b)
   
   ### Reason analyze (If you can)
   
code:org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine#route0
   
   not bind route value with every database when routeDataSources ,only return 
the database collection 
   
   so when routeTables ,every route value will be to route all tables for every 
database ,return cartesian set
   
   ![Uploading image.png…]()
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   has any plan to optimize it ???  or have some good idea
   
   expect:
   select * from db0.tb0 in (a,b)   # will be better: select * from db0.tb0 in 
(a);
   select * from db1.tb1 in (a,b)   #  will be better:  select * from db1.tb1 
in (b)
   ### Example codes for reproduce this issue (such as a github link).
   
   i want to change code when routeDataSources ,bind every route value to 
database ,but i donot know it will produce other 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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to