-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ParsingSQLRouter has a problem when select like this select * from table where xxx in () limit 0,20 #1348
Comments
Hi, could you follow issue template and give us more information? Bug ReportFor English only, other languages will not accept. Before report a bug, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details. Please answer these questions before submitting your issue. Thanks! Which version of Sharding-Sphere did you use?Which project did you use? Sharding-JDBC or Sharding-Proxy?Expected behaviorActual behaviorReason analyze (If you can)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). |
Which version of Sharding-Sphere did you use? shardingsphere 3.0.0.M3 Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-JDBC Expected behavior select * from table where xxx in () limit 0,20,xxx is shardingColumn. Actual behavior when one select is isSingleRouting select,the next select which is not SingleRouting select will have a NullPointerException:
Reason analyze (If you can) When one select is isSingleRouting,you will remove the selectStatement's limit field,but if the next select is not SingleRouting,you will use this field,then NullPointerException. The object selectStatement has been cached in ParsingResultCache's cache field. Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. |
please provide your SQL, log of show.sql and sharding rule configuration please provide: Example codes for reproduce this issue (such as a github link). |
I‘ve reproduced this issue: |
any progress? |
PreparedStatementRoutingEngine cache the SQLStatement objects. If the first SQL is single routing, the limit field of SQLStatement is set to null, and if the second SQL is multi routing, it get the cached SQLStatement first, and access to the limit field cause NPE.
|
version:
shardingsphere 3.0.0.M2
select * from table where xxx in () limit 0,20
xxx is shardingColumn,
when one select is isSingleRouting select,the next select which is not SingleRouting select will have a NullPointerException.bacause you set the selectStatement's feild limit to null in ParsingSQLRouter.
The text was updated successfully, but these errors were encountered: