You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:33:44 UTC

[GitHub] [shardingsphere] zhuzhenting opened a new issue, #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

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

   ## Bug Report
   
   ### version
   use encryption in my project, and the  maven dependency:
   ```xml       
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
               <version>5.1.2</version>
           </dependency>
   ```
   
   ### Expected behavior
   when I remove the encryption configuration, the sql works fine.
   ``` sql
   SELECT COUNT(*) FROM (SELECT DISTINCT (u.id), u.username, uc.card, u.sex, uc.grade_id, uc.grade_name, u.phone, u.email, uc.created AS createTime, u.country_calling_code AS countryCallingCode, u.nick_name, u.user_type AS accountType, a.tel AS attentionPhone, a.country_calling_code AS attentionCountryCallingCode, a.email AS attentionEmail, a.typeId AS attentionTypeId, uc.app_id AS appId, uo.utm AS origin, uo.level1, uo.level2, uo.level3, ut.tag_id FROM users u LEFT JOIN user_cards uc ON u.id = uc.uid LEFT JOIN attention a ON u.id = a.uid AND a.num = 1 LEFT JOIN user_origin uo ON u.id = uo.user_id LEFT JOIN user_tag ut ON u.id = ut.user_id AND ut.school_code = ? WHERE uc.areaCode = ? AND uc.created >= ? AND uc.created <= ?) TOTAL
   ```
   
   
   ### Actual behavior
   it throws an exception:
   ```java
   Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -5
   	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.addSQLRewriteUnits(RouteSQLRewriteEngine.java:96)
   	at org.apache.shardingsphere.infra.rewrite.engine.RouteSQLRewriteEngine.rewrite(RouteSQLRewriteEngine.java:72)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.rewrite(SQLRewriteEntry.java:73)
   	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.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:471)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:364)
   ```
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   this is my tables configuration:
   ``` yml
           tables:
             users:
               columns:
                 phone:
                   logicColumn: phone
                   plainColumn: phone
                   cipherColumn: phone_cipher
                   encryptorName: aes_encryptor
             attention:
               columns:
                 tel:
                   logicColumn: tel
                   plainColumn: tel
                   cipherColumn: tel_cipher
                   encryptorName: aes_encryptor
                 email:
                   logicColumn: email
                   plainColumn: email
                   cipherColumn: email_cipher
                   encryptorName: aes_encryptor
             recipient:
               columns:
                 tel:
                   logicColumn: tel
                   plainColumn: tel
                   cipherColumn: tel_cipher
                   encryptorName: aes_encryptor
   ```
   ### 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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #19905:
URL: https://github.com/apache/shardingsphere/issues/19905#issuecomment-1207148543

   What is your table structure?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zhuzhenting commented on issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by "zhuzhenting (via GitHub)" <gi...@apache.org>.
zhuzhenting commented on issue #19905:
URL: https://github.com/apache/shardingsphere/issues/19905#issuecomment-1419197010

   > This issue has been inactive for a long time, so I'm closing it now. If this problem persists, please reopen it or submit a new one.
   
   the bug still exists。 current version: 5.3.1


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64
URL: https://github.com/apache/shardingsphere/issues/19905


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang closed issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64
URL: https://github.com/apache/shardingsphere/issues/19905


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zhuzhenting commented on issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by GitBox <gi...@apache.org>.
zhuzhenting commented on issue #19905:
URL: https://github.com/apache/shardingsphere/issues/19905#issuecomment-1211504598

   > 
   I have given the complete sql and table configuration, You can build the table structure arbitrarily
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19905:
URL: https://github.com/apache/shardingsphere/issues/19905#issuecomment-1272349060

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #19905: COUNT sql. StringIndexOutOfBoundsException at AbstractSQLBuilder.java:64

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #19905:
URL: https://github.com/apache/shardingsphere/issues/19905#issuecomment-1407561683

   This issue has been inactive for a long time, so I'm closing it now.
   If this problem persists, please reopen it or submit a new one.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org