shardingsphere
shardingsphere copied to clipboard
RoutingCondition for updateStatement after parsing is not correct.
Bug Report
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
4.0.0-RC1-Snapshot
Which project did you use? Sharding-JDBC or Sharding-Proxy?
sharding-jdbc & sharding-proxy
Expected behavior
Sharding key is order_id, RoutingConditon of below SQL can be filled correctly.
update t_order set user_id=user_id-1 where user_id =? and order_id =?
Actual behavior
RoutingCondition is empty. routeConditions=Conditions(orCondition=OrCondition(andConditions=[]))
Reason analyze (If you can)
Antlr g4 file have a wrong parse rule for set user_id=user_id-1, set user_id=user_id+1 can be parsed succeed.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
failed to parse “user_id-1” , failed to match antlr rule "bitExpr MINUS_ bitExpr", "-1" must be parsed "MINUS_ bitExpr", but was parsed "NUMBER".