theodoretsai commented on issue #22572:
URL: 
https://github.com/apache/shardingsphere/issues/22572#issuecomment-1336618820

   I have checked out the code from the lastest version
   
   org.apache.shardingsphere.sharding.route.engine.type.standard:
   ```
   private Collection<String> routeDataSources(final TableRule tableRule, final 
ShardingStrategy databaseShardingStrategy, final List<ShardingConditionValue> 
databaseShardingValues) {
       if (databaseShardingValues.isEmpty()) {
           return tableRule.getActualDataSourceNames();
       }
       Collection<String> result = 
databaseShardingStrategy.doSharding(tableRule.getActualDataSourceNames(), 
databaseShardingValues, tableRule.getDataSourceDataNode(), props);
       Preconditions.checkState(!result.isEmpty(), "No database route info");
       
Preconditions.checkState(tableRule.getActualDataSourceNames().containsAll(result),
               "Some routed data sources do not belong to configured data 
sources. routed data sources: `%s`, configured data sources: `%s`", result, 
tableRule.getActualDataSourceNames());
       return result;
   }
   
   private Collection<DataNode> routeTables(final TableRule tableRule, final 
String routedDataSource,
                                            final ShardingStrategy 
tableShardingStrategy, final List<ShardingConditionValue> tableShardingValues) {
       Collection<String> availableTargetTables = 
tableRule.getActualTableNames(routedDataSource);
       Collection<String> routedTables = tableShardingValues.isEmpty()
               ? availableTargetTables
               : tableShardingStrategy.doSharding(availableTargetTables, 
tableShardingValues, tableRule.getTableDataNode(), props);
       Collection<DataNode> result = new LinkedList<>();
       for (String each : routedTables) {
           result.add(new DataNode(routedDataSource, each));
       }
       return result;
   }
   ```
   
   vs
   4.0.1 org.apache.shardingsphere.core.route.type.standard:
   
   ```
   private Collection<String> routeDataSources(final TableRule tableRule, final 
List<RouteValue> databaseShardingValues) {
       if (databaseShardingValues.isEmpty()) {
           return tableRule.getActualDatasourceNames();
       }
       Collection<String> result = new 
LinkedHashSet<>(shardingRule.getDatabaseShardingStrategy(tableRule).doSharding(tableRule.getActualDatasourceNames(),
 databaseShardingValues));
       Preconditions.checkState(!result.isEmpty(), "no database route info");
       
Preconditions.checkState(tableRule.getActualDatasourceNames().containsAll(result),
 
               "Some routed data sources do not belong to configured data 
sources. routed data sources: `%s`, configured data sources: `%s`", result, 
tableRule.getActualDatasourceNames());
       return result;
   }
   
   private Collection<DataNode> routeTables(final TableRule tableRule, final 
String routedDataSource, final List<RouteValue> tableShardingValues) {
       Collection<String> availableTargetTables = 
tableRule.getActualTableNames(routedDataSource);
       Collection<String> routedTables = new 
LinkedHashSet<>(tableShardingValues.isEmpty() ? availableTargetTables
               : 
shardingRule.getTableShardingStrategy(tableRule).doSharding(availableTargetTables,
 tableShardingValues));
       Preconditions.checkState(!routedTables.isEmpty(), "no table route info");
       Collection<DataNode> result = new LinkedList<>();
       for (String each : routedTables) {
           result.add(new DataNode(routedDataSource, each));
       }
       return result;
   }
   ```
   
   the routing logic seems to be the same, I haven't found a way to 
"communicate a partial match" for IN statements. Are there any changes 
elsewhere addressing this that I'm missing? If yes I can try to replicate the 
problem in the latest version.


-- 
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-unsubscr...@shardingsphere.apache.org

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

Reply via email to