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/07/30 08:27:44 UTC
[GitHub] [shardingsphere] xiangtao123 opened a new issue #6531: ### Cause: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.subquery.SubqueryExpressionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.complex.ComplexExpressionSegment
xiangtao123 opened a new issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531
## 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?
4.1.1
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
work on.
### Actual behavior
exception log:
Error updating database. Cause: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.subquery.SubqueryExpressionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.complex.ComplexExpressionSegment
### The error may exist in com/**/mapper/ScheduleExtMapper.xml
### The error may involve com.**.mapper.ScheduleExtMapper.insertByScheduleId-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_schedule_ext (id, template_id, creator_sum, organizer_sum, lecturer_sum, inviter_sum, appointment_sum, inviter_names) VALUES ('72df6b8e0bbb4cb9a162b8316e538fbd', (SELECT template_id FROM t_schedule WHERE id = '72df6b8e0bbb4cb9a162b8316e538fbd'), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 0), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 1), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 2), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 3), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 4), (SELECT GROUP_CONCAT(name) FROM (SELECT name FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND is_delete = 0 AND (user_type = 3 OR (user_type =
4 AND schedule_owner_operate = 1)) AND user_id != '' LIMIT 10) t))
### Cause: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.subquery.SubqueryExpressionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.complex.ComplexExpressionSegment
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 13 common frames omitted
Caused by: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.subquery.SubqueryExpressionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.complex.ComplexExpressionSegment
at org.apache.shardingsphere.underlying.rewrite.sql.token.pojo.generic.InsertValue.getValue(InsertValue.java:57)
at org.apache.shardingsphere.underlying.rewrite.sql.token.pojo.generic.InsertValue.toString(InsertValue.java:43)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken.appendInsertValue(ShardingInsertValuesToken.java:46)
at org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken.toString(ShardingInsertValuesToken.java:38)
at org.apache.shardingsphere.underlying.rewrite.sql.impl.RouteSQLBuilder.getSQLTokenText(RouteSQLBuilder.java:40)
at org.apache.shardingsphere.underlying.rewrite.sql.impl.AbstractSQLBuilder.toSQL(AbstractSQLBuilder.java:47)
at org.apache.shardingsphere.underlying.rewrite.engine.SQLRouteRewriteEngine.rewrite(SQLRouteRewriteEngine.java:50)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.rewrite(BasePrepareEngine.java:151)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRewrite(BasePrepareEngine.java:122)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:85)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:143)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy419.update(Unknown Source)
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doUpdate(MybatisSimpleExecutor.java:54)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 19 common frames omitted
### Reason analyze (If you can)
subquery sql not work?
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
actual sql:
INSERT INTO t_schedule_ext (id, template_id, creator_sum, organizer_sum, lecturer_sum, inviter_sum, appointment_sum, inviter_names) VALUES ('72df6b8e0bbb4cb9a162b8316e538fbd', (SELECT template_id FROM t_schedule WHERE id = '72df6b8e0bbb4cb9a162b8316e538fbd'), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 0), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 1), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 2), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 3), (SELECT COUNT(1) FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND user_type = 4), (SELECT GROUP_CONCAT(name) FROM (SELECT name FROM t_participant WHERE schedule_id = '72df6b8e0bbb4cb9a162b8316e538fbd' AND is_delete = 0 AND (user_type = 3 OR (user_type = 4 AND sc
hedule_owner_operate = 1)) AND user_id != '' LIMIT 10) t))
### 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on issue #6531: SubqueryExpressionSegment cannot be cast to ComplexExpressionSegment
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531#issuecomment-666395046
@xiangtao123 I'll check it.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] jingshanglu commented on issue #6531: SubqueryExpressionSegment cannot be cast to ComplexExpressionSegment
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531#issuecomment-666971691
It is ok on master branch.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] jingshanglu closed issue #6531: SubqueryExpressionSegment cannot be cast to ComplexExpressionSegment
Posted by GitBox <gi...@apache.org>.
jingshanglu closed issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531
----------------------------------------------------------------
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
[GitHub] [shardingsphere] jingshanglu commented on issue #6531: SubqueryExpressionSegment cannot be cast to ComplexExpressionSegment
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531#issuecomment-666955271
@xiangtao123 Now, it is ok on master branch,new version will fix it.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] xiangtao123 commented on issue #6531: SubqueryExpressionSegment cannot be cast to ComplexExpressionSegment
Posted by GitBox <gi...@apache.org>.
xiangtao123 commented on issue #6531:
URL: https://github.com/apache/shardingsphere/issues/6531#issuecomment-667019701
> It is ok on master branch.
3Q
----------------------------------------------------------------
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