strongduanmu opened a new issue #13537:
URL: https://github.com/apache/shardingsphere/issues/13537


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master branch
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   execute success
   
   ### Actual behavior
   
   ```
   [INFO ] 2021-11-10 18:59:44.945 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: ds_0 ::: SHOW COLUMNS FROM t_order 
   [ERROR] 2021-11-10 18:59:46.433 [Connection-1-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1967)
        at 
org.apache.shardingsphere.infra.rewrite.sql.impl.AbstractSQLBuilder.getConjunctionText(AbstractSQLBuilder.java:64)
        at 
org.apache.shardingsphere.infra.rewrite.sql.impl.AbstractSQLBuilder.toSQL(AbstractSQLBuilder.java:47)
        at 
org.apache.shardingsphere.infra.rewrite.engine.RouteSQLRewriteEngine.rewrite(RouteSQLRewriteEngine.java:52)
        at 
org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.rewrite(SQLRewriteEntry.java:71)
        at 
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.rewrite(KernelProcessor.java:59)
        at 
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:47)
        at 
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:121)
        at 
org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:61)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:99)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:72)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   config file
   ```
   schemaName: encrypt_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/encrypt?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !ENCRYPT
     encryptors:
       sursen_encryptor:
         type: SURSEN
     tables:
       t_order:
         columns:
           order_id:
             cipherColumn: order_id
             encryptorName: sursen_encryptor
           user_id:
             cipherColumn: user_id
             encryptorName: sursen_encryptor
           content:
             cipherColumn: content
             encryptorName: sursen_encryptor
       t_order_item:
         columns:
           item_id:
             cipherColumn: item_id
             encryptorName: sursen_encryptor
           order_id:
             cipherColumn: order_id
             encryptorName: sursen_encryptor
           user_id:
             cipherColumn: user_id
             encryptorName: sursen_encryptor
           sell_price:
             cipherColumn: sell_price
             encryptorName: sursen_encryptor
   ```
   
   And then execute sql like this:
   
   ```sql
   SELECT * FROM t_order o INNER JOIN t_order_item i WHERE o.order_id = 
i.item_id;
   ```
   
   ### 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