TeslaCN opened a new issue, #19545:
URL: https://github.com/apache/shardingsphere/issues/19545

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master - 5976d9eaa392875fb034c7207717145c5d483bfc
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Query worked.
   
   ```sql
   select * from bmsql_item limit 10;
   ```
   
   ### Actual behavior
   
   ```
   [ERROR] 2022-07-26 11:19:11.346 [ShardingSphere-Command-0] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Cannot invoke 
"org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getAllColumnNames(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:116)
        at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:160)
        at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:143)
        at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:128)
        at 
org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:117)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:72)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:77)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:61)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:110)
        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)
   ```
   
   
![image](https://user-images.githubusercontent.com/20503072/180916424-a647c49e-44b9-4ae5-b7f4-fc602a7ec008.png)
   
   Query without wildcard worked.
   
![image](https://user-images.githubusercontent.com/20503072/180917114-99be0cc1-b376-471c-b717-63f54a14e196.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   server.yaml
   ```yaml
   props:
     proxy-frontend-database-protocol-type: MySQL
   ```
   
   config-sharding.yaml
   ```yaml
   schemaName: bmsql_sharding
   dataSources:
     ds_0:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_0
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_1:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_1
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_2:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_2
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_3:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_3
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
   
   rules:
     - !SHARDING
       defaultDatabaseStrategy:
         none:
       defaultTableStrategy:
         none:
       keyGenerators:
       tables:
         bmsql_item:
           actualDataNodes: ds_${0..3}.bmsql_item
           databaseStrategy:
             standard:
               shardingColumn: i_id
               shardingAlgorithmName: mod_4
       shardingAlgorithms:
         mod_4:
           type: MOD
           props:
             sharding-count: 4
   ```
   
   ```sql
   create table bmsql_item (
     i_id     integer      not null,
     i_name   varchar(24),
     i_price  decimal(5,2),
     i_data   varchar(50),
     i_im_id  integer
   );
   ```
   


-- 
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]

Reply via email to