Skip to content
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

bugfix: support IN/BETWEEN WHERE clause recognize #965

Conversation

hongweiyi
Copy link
Contributor

Signed-off-by: hongwei yi hongweiyi@hotmail.com

Ⅰ. Describe what this PR did

support IN/BETWEEN WHERE clause recognize

Ⅱ. Does this pull request fix one issue?

fixes #867

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented May 4, 2019

Codecov Report

Merging #965 into develop will increase coverage by 0.05%.
The diff coverage is 71.42%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #965      +/-   ##
=============================================
+ Coverage      37.11%   37.17%   +0.05%     
- Complexity      1027     1033       +6     
=============================================
  Files            225      225              
  Lines           8905     8923      +18     
  Branches        1070     1079       +9     
=============================================
+ Hits            3305     3317      +12     
- Misses          5212     5215       +3     
- Partials         388      391       +3
Impacted Files Coverage Δ Complexity Δ
...rm/datasource/sql/druid/MySQLUpdateRecognizer.java 63.07% <71.42%> (+0.36%) 10 <0> (+2) ⬆️
...rm/datasource/sql/druid/MySQLDeleteRecognizer.java 74.28% <71.42%> (-1.58%) 6 <0> (+2)
...urce/sql/druid/MySQLSelectForUpdateRecognizer.java 68.75% <71.42%> (-0.3%) 7 <0> (+2)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b0eb79...5438ead. Read the comment docs.

@slievrly
Copy link
Member

slievrly commented May 4, 2019

@wenshao could I use SQLASTVisitor.visit(SQLExpr sqlExpr),just not analyze the implementation class SQLExpr?

@hongweiyi
Copy link
Contributor Author

@wenshao could I use SQLASTVisitor.visit(SQLExpr sqlExpr),just not analyze the implementation class SQLExpr?

Use visit(SQLExpr) will get java: no suitable method found for visit(com.alibaba.druid.sql.ast.SQLExpr) error while compiling, unless Druid has a visit(SQLExpr) method to help user check parameter automatically. 🙈

@xingfudeshi xingfudeshi self-requested a review May 4, 2019 23:51
@xingfudeshi
Copy link
Member

@hongweiyi do you know how to reproduce this problem?

@xingfudeshi
Copy link
Member

i have tested with the following code,but everything runs well.maybe i missed something.
image
table:
order_tbl_two
image

@hongweiyi
Copy link
Contributor Author

@xingfudeshi maybe u should use PreparedStatement instead of Statement

image
image

@xingfudeshi
Copy link
Member

@hongweiyi yes.should use prepared statement to reproduce this problem.thanks.
image
java.lang.ClassCastException: com.alibaba.druid.sql.ast.expr.SQLInListExpr cannot be cast to com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr at io.seata.rm.datasource.sql.druid.MySQLUpdateRecognizer.getWhereCondition(MySQLUpdateRecognizer.java:120) at io.seata.rm.datasource.exec.UpdateExecutor.beforeImage(UpdateExecutor.java:78) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitFalse(AbstractDMLBaseExecutor.java:71) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitTrue(AbstractDMLBaseExecutor.java:93) at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:57) at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:86) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:101) at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:47) at io.seata.rm.datasource.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:85) at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:867) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:883) at com.alibaba.fescar.workshop.service.impl.OrderServiceImpl.create(OrderServiceImpl.java:93) at com.alibaba.dubbo.common.bytecode.Wrapper2.invokeMethod(Wrapper2.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) at io.seata.dubbo.alibaba.TransactionPropagationFilter.invoke(TransactionPropagationFilter.java:61) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:173) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xingfudeshi xingfudeshi merged commit a670592 into apache:develop May 5, 2019
@hongweiyi hongweiyi deleted the support_in_between_where_clause_recognize branch May 5, 2019 08:48
nick-tan pushed a commit to nick-tan/seata that referenced this pull request Jul 12, 2019
@wangliang181230 wangliang181230 added this to the 0.5.* milestone Aug 9, 2021
@funky-eyes
Copy link
Contributor

由于前期Seata社区治理规范问题部分代码作者未签署CLA,可能引发社区知识产权风险问题。请所有在Seata社区贡献过代码(包含:主项目、官网、samples和多语言项目等)的 contributor 帮忙在这个链接登录github账号签署相应的开发者CLA,https://cla-assistant.io/seata/seata 。2023.1.31 未签署CLA的代码将会被rewrite,拜托大家帮忙签一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException occured when using @GlobalTransactional and SQL with 'update sql'
6 participants