chengh1 opened a new issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623


   ## 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?
   5.0.0-RC1-SNAPSHOT
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   When inserting statement with expressions of a non-broadcast table, an 
exception should be thrown to avoid routing to all datanodes, which will cause 
dirty data problem.
   ### Actual behavior
   Insert clause when sharding key with expression will routing to all 
dataNodes, cause dirty data problem.
   ### Reason analyze (If you can)
   
![image](https://user-images.githubusercontent.com/39934378/127857753-1e8c4198-b67e-4fe7-b64b-7c03ab026c44.png)
   When performing SQL parsing, sharding key with expression will be parsed as 
BinaryOperationExpression, but when generating sharding conditions, only 
parsing the three types of SimpleExpressionSegment, NowExpression, and 
NullExpression, other types will not be parsed, so the final ShardingCondition 
list is Empty, when routing based on shardingCondition list, will full routing.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1.order_id is sharding key.
   2.execute sql  : 
   INSERT INTO t_order (order_id, user_id, status) VALUES (1+1, 2, 'insert');
   3.it will route to all datanodes, every datanode will have a record.
   ### 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