shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Support sub-query Sql

Open JeddyHj opened this issue 7 years ago • 1 comments

Routing to single data node MySQL in documents is 100% supported, but I found that sub-query reported errors in actual test usage.

SQL is as follows: SELECT COUNT(*) FROM (SELECT * FROM chat_status WHERE id = '123' ) o

Errors were reported as follows: Caused by: java.lang.IllegalStateException: Must have sharding column with subquery. At com. google. common. base. Preconditions. checkState (Preconditions. java: 173) At io. shardingsphere. core. routing. router. sharding. ParsingSQLRouter. mergeShardingValue For SubQuery (ParsingSQLRouter. java: 154) At io. shardingsphere. core. routing. router. sharding. ParsingSQLRouter. route (ParsingSQLRouter. java: 100) At io. shardingsphere. core. routing. PreparedStatement Routing Engine. route (PreparedStatement Routing Engine. java: 64) At io. shardingsphere. shardingjdbc. jdbc. core. statement. ShardingPreparedStatement. sqlRoute (ShardingPreparedStatement. java: 214) Shardingsphere. shardingjdbc. jdbc. core. statement. ShardingPreparedStatement. executeQuery (ShardingPreparedStatement. java: 106) At im.qingtui.db.route.test.Test. (Test.java:29) At sun. reflect. Native Constructor Accessor Impl. new Instance 0 (Native Method) At sun. reflect. Native Constructor Accessor Impl. new Instance (Native Constructor Accessor Impl. java: 62) At sun. reflect. Delegating Constructor Accessor Impl. new Instance (Delegating Constructor Accessor Impl. java: 45) At java.lang.reflect.Constructor.newInstance (Constructor.java:423) At org. spring framework. beans. BeanUtils. instantiateClass (BeanUtils. java: 142) ... 18 more

JeddyHj avatar Feb 15 '19 08:02 JeddyHj

duplicate with #1753

terrymanu avatar Feb 15 '19 09:02 terrymanu