wsm12138 opened a new issue, #20952: URL: https://github.com/apache/shardingsphere/issues/20952
## Bug Report ### Which version of ShardingSphere did you use? master 2efac8447e58dfb37836f039983e320963d4b347 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior execute success ### Actual behavior <img width="1568" alt="image" src="https://user-images.githubusercontent.com/86462784/189830739-3a0429e2-5c99-4739-99be-8372d3bd11fe.png"> ### Reason analyze (If you can) ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 1. start proxy use config-rw.yaml ``` databaseName: rw dataSources: write_ds: password: url: jdbc:mysql://192.168.10.20:13308/test?serverTimezone=UTC&useSSL=false username: test minPoolSize: 1 connectionTimeoutMilliseconds: 30000 maxLifetimeMilliseconds: 1800000 readOnly: false idleTimeoutMilliseconds: 60000 maxPoolSize: 300 read_ds_0: password: url: jdbc:mysql://192.168.10.20:13309/test?serverTimezone=UTC&useSSL=false username: test minPoolSize: 1 connectionTimeoutMilliseconds: 30000 maxLifetimeMilliseconds: 1800000 readOnly: false idleTimeoutMilliseconds: 60000 maxPoolSize: 300 rules: - !SINGLE {} - !READWRITE_SPLITTING dataSources: readwrite_ds: loadBalancerName: random staticStrategy: readDataSourceNames: - read_ds_0 writeDataSourceName: write_ds loadBalancers: random: type: RANDOM ``` server.yaml ``` rules: - !AUTHORITY users: - root@%:root - sharding@:sharding provider: type: ALL_PERMITTED props: proxy-mysql-default-version: 8.0.29 ``` 2. execute DistSQL ``` ALTER READWRITE_SPLITTING RULE readwrite_ds ( WRITE_RESOURCE=write_ds, READ_RESOURCES(read_ds_0), TYPE(NAME="FIXED_REPLICA_RANDOM") ); ``` 3. start query in transaction ``` mysql> ALTER READWRITE_SPLITTING RULE readwrite_ds ( -> WRITE_RESOURCE=write_ds, -> READ_RESOURCES(read_ds_0), -> TYPE(NAME="FIXED_REPLICA_RANDOM") -> ); Query OK, 0 rows affected (0.12 sec) mysql> export database config; +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | result | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | databaseName: rw dataSources: write_ds: password: sphereEx@2021 url: jdbc:mysql://192.168.10.20:13308/test?serverTimezone=UTC&useSSL=false username: test minPoolSize: 1 connectionTimeoutMilliseconds: 30000 maxLifetimeMilliseconds: 1800000 readOnly: false idleTimeoutMilliseconds: 60000 maxPoolSize: 300 read_ds_0: password: sphereEx@2021 url: jdbc:mysql://192.168.10.20:13309/test?serverTimezone=UTC&useSSL=false username: test minPoolSize: 1 connectionTimeoutMilliseconds: 30000 maxLifetimeMilliseconds: 1800000 readOnly: false idleTimeoutMilliseconds: 60000 maxPoolSize: 300 rules: - !SINGLE {} - !READWRITE_SPLITTING dataSources: readwrite_ds: loadBalancerName: readwrite_ds_FIXED_REPLICA_RANDOM staticStrategy: readDataSourceNames: - read_ds_0 writeDataSourceName: write_ds loadBalancers: readwrite_ds_FIXED_REPLICA_RANDOM: type: FIXED_REPLICA_RANDOM | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> begin; Query OK, 0 rows affected (0.00 sec) mysql> preview select * from sbtest1; ERROR 30000 (HY000): Unknown exception: Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getVisibleColumnNames(String)" because the return value of "java.util.Map.get(Object)" is null mysql> preview select * from sbtest1; ``` *error.log* ``` [ERROR] 2022-09-13 14:48:16.308 [ShardingSphere-Command-686] o.a.s.p.f.c.CommandExecutorTask - Exception occur: java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getVisibleColumnNames(String)" because the return value of "java.util.Map.get(Object)" is null at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.getShorthandColumnsFromSimpleTableSegment(ProjectionEngine.java:163) at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.createProjection(ProjectionEngine.java:117) at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.createProjection(ProjectionEngine.java:82) at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionsContextEngine.getProjections(ProjectionsContextEngine.java:77) at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionsContextEngine.createProjectionsContext(ProjectionsContextEngine.java:67) at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:117) at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:163) at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:146) at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:131) at org.apache.shardingsphere.proxy.backend.handler.distsql.rul.sql.PreviewHandler.getRows(PreviewHandler.java:101) at org.apache.shardingsphere.proxy.backend.handler.distsql.rul.SQLRULBackendHandler.createMergedResult(SQLRULBackendHandler.java:62) at org.apache.shardingsphere.proxy.backend.handler.distsql.rul.SQLRULBackendHandler.execute(SQLRULBackendHandler.java:53) at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:94) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) ``` ### 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]
