JNero opened a new issue #8159:
URL: https://github.com/apache/shardingsphere/issues/8159


   when i run sql_1(update) in my project:
    sql_1: `update classification set status=0 and operator_id=0 where 
is_delete=0 AND status=1 AND TIMESTAMPDIFF(MINUTE, update_time,  NOW())>=30 `
   then a error occurs:
   
![image](https://user-images.githubusercontent.com/9392133/99143955-e5f93400-269c-11eb-97d5-83680a3e9f7b.png)
   
   `Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is 
org.apache.ibatis.exceptions.PersistenceException: 
   ### Error updating database.  Cause: java.lang.ClassCastException: 
org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.OrPredicateSegment
 cannot be cast to 
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.ExpressionSegment
   ### The error may exist in SQLMapper.java (best guess)
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: update classification set status=0 and operator_id=0 where 
is_delete=0 AND status=1 AND TIMESTAMPDIFF(MINUTE, update_time,  NOW())>=30
   ### Cause: java.lang.ClassCastException: 
org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.OrPredicateSegment
 cannot be cast to 
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.ExpressionSegment`
   
   and then  replace sql_1 like this(select):
   sql_2:`select count(1) from classification`
   it can run in normal ,and result is this:
   
![image](https://user-images.githubusercontent.com/9392133/99143916-69665580-269c-11eb-8365-d1ff7e5a30fd.png)
   
   `[text-format]17:08:00 592  INFO (ShardingSphere-SQL:74) - Logic SQL: select 
count(1) from classification
   [text-format]17:08:00 593  INFO (ShardingSphere-SQL:74) - SQLStatement: 
SelectStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@5a56e077,
 
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@347c891f),
 
tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@347c891f,
 projectionsContext=ProjectionsContext(startIndex=7, stopIndex=14, 
distinctRow=false, projections=[AggregationProjection(type=COUNT, 
innerExpression=(1), alias=Optional.empty, derivedAggregationProjections=[], 
index=-1)]), 
groupByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.GroupByContext@5f5b80fc,
 
orderByContext=org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByContext@1f9ea07b,
 
paginationContext=org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext@72a6aea7,
 containsSubquery=false)
   [text-format]17:08:00 593  INFO (ShardingSphere-SQL:74) - Actual SQL: ds0 
::: select count(1) from classification_0
   [text-format]17:08:00 593  INFO (ShardingSphere-SQL:74) - Actual SQL: ds0 
::: select count(1) from classification_1
   [text-format]17:08:00 593  INFO (ShardingSphere-SQL:74) - Actual SQL: ds0 
::: select count(1) from classification_2
   [text-format]17:08:00 593  INFO (ShardingSphere-SQL:74) - Actual SQL: ds0 
::: select count(1) from classification_3`
   
   I check the manual and doc ,sharding-jdbc support dml including insert and 
update .
   so  where the problem is ?
   
   here is my version
   
![image](https://user-images.githubusercontent.com/9392133/99143905-5784b280-269c-11eb-87e7-b6d7d60b50a2.png)
   
   and configuration:
   
![image](https://user-images.githubusercontent.com/9392133/99143943-b77b5900-269c-11eb-87b8-d6ab2759a49f.png)
   
   
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to