You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/04/11 09:45:07 UTC
[GitHub] [incubator-shardingsphere] liunancun opened a new issue #2192: Tip
Must have sharding column with subquery error
liunancun opened a new issue #2192: Tip Must have sharding column with subquery error
URL: https://github.com/apache/incubator-shardingsphere/issues/2192
sharding version:
`<dependency>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>`
application.properties config:
`sharding.jdbc.datasource.names=master,seller
sharding.jdbc.datasource.master.type=com.alibaba.druid.pool.DruidDataSource
sharding.jdbc.datasource.master.url=jdbc:mysql://192.168.99.214:3306/bessky_one?useSSL=false
sharding.jdbc.datasource.master.username=bessky_pss
sharding.jdbc.datasource.master.password=20092009
sharding.jdbc.datasource.seller.type=com.alibaba.druid.pool.DruidDataSource
sharding.jdbc.datasource.seller.url=jdbc:mysql://192.168.99.214:3306/bessky_two?useSSL=false
sharding.jdbc.datasource.seller.username=bessky_pss
sharding.jdbc.datasource.seller.password=20092009
sharding.jdbc.config.sharding.default-data-source-name=master
sharding.jdbc.config.sharding.tables.t_two.actual-data-nodes=seller.t_two`
Execute SQL:
`select * from (select id from t_two) two`
Error message:
`java.lang.IllegalStateException: Must have sharding column with subquery.
at com.google.common.base.Preconditions.checkState(Preconditions.java:173) ~[guava-18.0.jar:na]
at io.shardingsphere.core.routing.router.sharding.ParsingSQLRouter.mergeShardingValueForSubQuery(ParsingSQLRouter.java:154) ~[sharding-core-3.1.0.jar:na]
at io.shardingsphere.core.routing.router.sharding.ParsingSQLRouter.route(ParsingSQLRouter.java:100) ~[sharding-core-3.1.0.jar:na]
at io.shardingsphere.core.routing.StatementRoutingEngine.route(StatementRoutingEngine.java:55) ~[sharding-core-3.1.0.jar:na]
at io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingStatement.sqlRoute(ShardingStatement.java:247) ~[sharding-jdbc-core-3.1.0.jar:na]
at io.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingStatement.executeQuery(ShardingStatement.java:89) ~[sharding-jdbc-core-3.1.0.jar:na]
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:438) ~[spring-jdbc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:375) ~[spring-jdbc-5.1.6.RELEASE.jar:5.1.6.RELEASE]`
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services