poo0054 opened a new issue, #18926: URL: https://github.com/apache/shardingsphere/issues/18926
## 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? 5.1.0 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Expected behavior Use a simple example to divide the database ### Actual behavior Route table null does not exist, available actual table: [oms_master_order_0, oms_master_order_1] ### Reason analyze (If you can) to configure oms_master_order_$->{id % 2} ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. > This is my configuration ```properties spring.shardingsphere.enabled=true spring.shardingsphere.datasource.names=oms spring.shardingsphere.datasource.oms.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.oms.driver-class-name=com.mysql.cj.jdbc.Driver #spring.shardingsphere.datasource.oms.jdbc-url=jdbc:mysql://120.78.254.245:3306/yidian_oms #spring.shardingsphere.datasource.oms.username=yidian #spring.shardingsphere.datasource.oms.password=Z%oYiT$IX4cm spring.shardingsphere.datasource.oms.url=jdbc:mysql://192.168.0.128:3306/yidian_oms?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8 spring.shardingsphere.datasource.oms.username=root spring.shardingsphere.datasource.oms.password=root spring.shardingsphere.rules.sharding.tables.oms_master_order.actual-data-nodes=oms.oms_master_order_$->{0..1} spring.shardingsphere.rules.sharding.tables.oms_master_order.table-strategy.standard.sharding-column=id spring.shardingsphere.rules.sharding.tables.oms_master_order.table-strategy.standard.sharding-algorithm-name=master-order-inline spring.shardingsphere.rules.sharding.sharding-algorithms.master-order-inline.type=INLINE #spring.shardingsphere.rules.sharding.sharding-algorithms.master-order-inline.props=strategy #spring.shardingsphere.rules.sharding.sharding-algorithms.master-order-inline.props.algorithmClassName=cn.dian1.oms.core.sharding.TableShardingAlgorithm spring.shardingsphere.rules.sharding.sharding-algorithms.master-order-inline.props.algorithm-expression=oms_master_order_$->{id % 2} spring.shardingsphere.props.sql-show=true ``` > This is the statement I execute SQL : ```java @GetMapping(value = "/testSharding") public String testSharding() { jdbcTemplate.update("insert into oms_master_order (id, masterOrderNo, containerNumber, create_time) values (?,?,?,?)", 100, "100", "123456", new Date()); // 100, "100", "123456", '2022-06-15 14:24:41'); return "成功了"; } ``` This may be the reason for the problem. I don't understand that there will be a parsing failure and a "null" will be returned ```java private Collection<String> doSharding(final Collection<String> availableTargetNames, final ListShardingConditionValue<?> shardingValue) { Collection<String> result = new LinkedList<>(); for (Comparable<?> each : shardingValue.getValues()) { String target; //-----------》null target = shardingAlgorithm.doSharding(availableTargetNames, new PreciseShardingValue(shardingValue.getTableName(), shardingValue.getColumnName(), each)); if (null != target && availableTargetNames.contains(target)) { result.add(target); } else if (null != target && !availableTargetNames.contains(target)) { throw new ShardingSphereException(String.format("Route table %s does not exist, available actual table: %s", target, availableTargetNames)); } } return result; } ``` ### 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]
