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

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   ```
   we find java version: java8, full_version=1.8.0_312
   ShardingSphere-5.1.3-SNAPSHOT
   Commit ID: dirty-7bfa655d42754ec1144d26af7089962703d840e6
   Commit Message: Optimize sharding tables route logic when execute cursor 
statement (#18413)
   Branch: 7bfa655d42754ec1144d26af7089962703d840e6
   Build time: 2022-06-20T10:04:48+0800
   ```
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   ```
   sharding_db=>       preview select * from  e;
         preview select * from  f;
         preview select * from  g; data_source_name |    actual_sql
   ------------------+------------------
    ds_1             | select * from  e
   (1 row)
   
   sharding_db=>  data_source_name |    actual_sql
   ------------------+------------------
    ds_2            | select * from  f
   (1 row)
   
   sharding_db=>
    data_source_name |    actual_sql
   ------------------+------------------
    ds_3             | select * from  g
   (1 row)
   ```
   ### Actual behavior
   ```
   sharding_db=>       preview select * from  e;
         preview select * from  f;
         preview select * from  g; data_source_name |    actual_sql
   ------------------+------------------
    ds_1             | select * from  e
   (1 row)
   
   sharding_db=>  data_source_name |    actual_sql
   ------------------+------------------
    ds_1             | select * from  f
   (1 row)
   
   sharding_db=>
    data_source_name |    actual_sql
   ------------------+------------------
    ds_2             | select * from  g
   (1 row)
   ```
   ### Reason analyze (If you can)
   use yaml  Show the normal
   but use distsql  'ALTER SQL_PARSER RULE SQL_COMMENT_PARSE_ENABLE=true;' 
,Showing unexpected results
   maybe distsql have  bug?
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   #### config-sharding.yaml
   ```
   databaseName: sharding_db
   
   dataSources:
     ds_1:
       url: jdbc:opengauss://ip:prot/demo_ds_0
       username: gaussdb
       password:  
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_2:
       url: jdbc:opengauss://ip:prot/demo_ds_1
       username: gaussdb
       password:  
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_3:
       url: jdbc:opengauss://ip:prot/dzq
       username: gaussdb
       password:  
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !SHARDING
     tables:
       d:
         actualDataNodes: ds_1.d_1,ds_2.d_2,ds_3.d_3
         databaseStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: d_database_inline
         tableStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: d_table_inline
     broadcastTables:
       - a
       - b
       - c
     defaultDatabaseStrategy:
       none:
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       d_database_inline:
         type: INLINE
         props:
           algorithm-expression: ds_${id % 3 + 1}
       d_table_inline:
         type: INLINE
         props:
           algorithm-expression: d_${id % 3 + 1}
   ```
   
   #### server.yaml
   ```
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: 630_dzq
         server-lists: ip:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
     overwrite: true
   
   rules:
     - !AUTHORITY
       users:
         - root@%:root
       provider:
         type: ALL_PERMITTED
   
   props:
     sql-show: true
   ```
   
   ####
   sql
   ```
   /* ShardingSphere hint: dataSourceName=ds_1 */ CREATE TABLE e(id int, name 
char);
   INSERT INTO e(id, name) VALUES(1, '1'), (2, '2'), (3, '3');
   
   /* ShardingSphere hint: dataSourceName=ds_2 */ CREATE TABLE f(id int, name 
char);
   INSERT INTO f(id, name) VALUES(1, '1'), (2, '2'), (3, '3');
   
   /* ShardingSphere hint: dataSourceName=ds_3 */ CREATE TABLE g(id int, name 
char);
   INSERT INTO g(id, name) VALUES(1, '1'), (2, '2'), (3, '3');
   ```
   
   ### 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]

Reply via email to