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 2020/04/02 03:37:08 UTC
[GitHub] [incubator-shardingsphere] Boomkeeper commented on issue #4963:
Single table query with subquery can not parse with sharding
Boomkeeper commented on issue #4963: Single table query with subquery can not parse with sharding
URL: https://github.com/apache/incubator-shardingsphere/issues/4963#issuecomment-607602897
**Is there a temporary solution or emergency solution please?**
I have encountered a same problem about 'subquery' recently,and the process of my task also delayed.
something here maybe helpful:
**version**
> <dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>4.0.1</version>
</dependency>
**SQL**
> SELECT COUNT(1) FROM (
SELECT id, pin, status, created_time, created_by, delete_flag
FROM t_table_123
WHERE delete_flag = 1
AND pin IN (?)
) TOTAL
**configuration**
> spring.shardingsphere.encrypt.tables.t_table_123.columns.pin.encryptor=default_encryptor
spring.shardingsphere.encrypt.tables.t_table_123.columns.pin.plainColumn=pin
spring.shardingsphere.encrypt.tables.t_table_123.columns.pin.cipherColumn=pin_encrypt
**exception**
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -3
at java.lang.String.substring(String.java:1967)
at org.apache.shardingsphere.underlying.rewrite.sql.impl.AbstractSQLBuilder.getConjunctionText(AbstractSQLBuilder.java:58)
at org.apache.shardingsphere.underlying.rewrite.sql.impl.AbstractSQLBuilder.toSQL(AbstractSQLBuilder.java:50)
at org.apache.shardingsphere.underlying.rewrite.engine.impl.DefaultSQLRewriteEngine.rewrite(DefaultSQLRewriteEngine.java:34)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:171)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:138)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:67)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 41 more
So, what can I do now to avoid exception?
Thanks.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services