guhuining opened a new issue, #30922: URL: https://github.com/apache/shardingsphere/issues/30922
### Which version of ShardingSphere did you use? 5.4.1 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Expected behavior You can find the demo project here: [https://github.com/guhuining/shardingSphereIssue](https://github.com/guhuining/shardingSphereIssue) As you can see, here is an actual data node which is "sharding_test.test_{0..4}" and it has two rules. One is named as "test_", which has a standard sharding algorithm. Another is named as "test_hint_" which has a hint sharding algorithm. ```yaml rules: - !SHARDING tables: test_: actualDataNodes: sharding_test.test_$->{0..4} tableStrategy: standard: shardingColumn: id shardingAlgorithmName: ModAlgorithm test_hint_: actualDataNodes: sharding_test.test_$->{0..4} tableStrategy: hint: shardingAlgorithmName: HintAlgorithm # Algorithm shardingAlgorithms: ModAlgorithm: type: CLASS_BASED props: strategy: standard algorithmClassName: com.demo.ModAlgorithm HintAlgorithm: type: CLASS_BASED props: strategy: hint algorithmClassName: com.demo.HintAlgorithm props: sql-show: true ``` And there is two sql need to execute, the code is : ```java ds.getConnection() .prepareStatement("SELECT * FROM test_ WHERE id = 1") .executeQuery(); try (HintManager hintManager = HintManager.getInstance()) { hintManager.addTableShardingValue("test_hint_", 2); ds.getConnection() .prepareStatement("SELECT * FROM test_hint_") .executeQuery(); } ``` In version 5.3.2, this code run perfectly, both these rules can work. the output is: ``` 22:55:36.939 [main] INFO ShardingSphere-SQL - Logic SQL: SELECT * FROM test_ WHERE id = 1 22:55:36.939 [main] INFO ShardingSphere-SQL - Actual SQL: sharding_test ::: SELECT * FROM test_1 WHERE id = 1 22:55:36.962 [main] INFO ShardingSphere-SQL - Logic SQL: SELECT * FROM test_hint_ 22:55:36.962 [main] INFO ShardingSphere-SQL - Actual SQL: sharding_test ::: SELECT * FROM test_2 ``` ### Actual behavior But if you change the version of shardingsphere to 5.4.1, this code will raise an error: ``` 23:10:33.551 [main] INFO ShardingSphere-SQL - Logic SQL: SELECT * FROM test_ WHERE id = 1 23:10:33.552 [main] INFO ShardingSphere-SQL - Actual SQL: sharding_test ::: SELECT * FROM test_1 WHERE id = 1 Exception in thread "main" org.apache.shardingsphere.infra.exception.TableNotExistsException: Table or view `test_hint_` does not exist. at org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.lambda$checkTableExists$4(SimpleTableSegmentBinder.java:146) at org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41) at org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:143) at org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:82) at org.apache.shardingsphere.infra.binder.segment.from.TableSegmentBinder.bind(TableSegmentBinder.java:54) at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:56) at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:46) at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bindDMLStatement(SQLBindEngine.java:100) at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:80) at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:71) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:202) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:167) at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:83) at com.demo.Main.main(Main.java:29) ``` It seems that the logical table named "test_hint_" can't be got by shardingsphere. ### Reason analyze (If you can) ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. change the version 5.3.2 to 5.4.1, the error will occur. ### Example codes for reproduce this issue (such as a github link). [https://github.com/guhuining/shardingSphereIssue](https://github.com/guhuining/shardingSphereIssue) -- 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]
