shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

RoutingCondition for updateStatement after parsing is not correct.

Open cherrylzhao opened this issue 7 years ago • 1 comments

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).

cherrylzhao avatar Apr 29 '19 07:04 cherrylzhao

failed to parse “user_id-1” , failed to match antlr rule "bitExpr MINUS_ bitExpr", "-1" must be parsed "MINUS_ bitExpr", but was parsed "NUMBER".

codefairy08 avatar Apr 30 '19 06:04 codefairy08