You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/29 09:47:21 UTC
[GitHub] [shardingsphere] zhaolin81 opened a new issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
zhaolin81 opened a new issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850
## 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 **more than 7 days** 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?
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
### Expected behavior
### Actual behavior
### Reason 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).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-929809703
I have checked this sql on master, it's ok. This issue can be closed.
` select * from t_order where DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d') limit ?,?`
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy edited a comment on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy edited a comment on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-748741716
@strongduanmu
版本 4.1.1
你好我做了个测试,传递的参数如果为string类型就报下面的错误,如果把类型修正为Date类型则不会报如下错误
配置:
```yml
spring:
shardingsphere:
encrypt:
encryptors:
aesEncryptor:
type: aes
props:
aes.key.value: 123456
tables:
linkman:
columns:
mobile:
plainColumn: mobile
cipherColumn: mobile_encrypted
encryptor: aesEncryptor
datasource:
names: ds
ds:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://localhost:3306/shardingsphere_test?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
username: root
password: root
connection-timeout: 30000
maximum-pool-size: 20
minimum-idle: 5
auto-commit: true
idle-timeout: 600000
pool-name: crm-hikari
max-lifetime: 1800000
connection-test-query: SELECT 1
props:
query.with.cipher.column: false
```
代码:
```java
<select id="selectByTime" resultMap="BaseResultMap" parameterType="string">
SELECT <include refid="Base_Column_List"/>
FROM linkman
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
List<Linkman> selectByTime(@Param("createTime") String createTime);
//如果把createTime的类型修改为Date类型则不会报错.
```
```code
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 49 more
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:51)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48)
at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:161)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy95.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:136)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy94.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 55 more
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-748745536
@strongduanmu
换成4.0.1版本后的结果,正常运行不报错
```code
[] 2020-12-21 12:07:04.235 DEBUG 16348 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Preparing: SELECT count(0) FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?, '%Y-%m-%d')
[] 2020-12-21 12:07:04.246 DEBUG 16348 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Parameters: 2020-12-21 12:07:04(String)
[] 2020-12-21 12:07:04.768 DEBUG 16348 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : <== Total: 1
[] 2020-12-21 12:07:04.773 DEBUG 16348 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Preparing: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
[] 2020-12-21 12:07:04.774 DEBUG 16348 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Parameters: 2020-12-21 12:07:04(String), 30(Integer)
[] 2020-12-21 12:07:04.804 DEBUG 16348 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : <== Total: 30
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zhaolin81 commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
zhaolin81 commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-635883311
PreparedStatement ps = conn.prepareStatement("select * from test where DATE_FORMAT(create_date, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d') limit ?,?");
ps.setString(1,"2020-02-01");
ps.setInt(2,1);
ps.setInt(3,10);
---
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:50) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99) ~[shardingsphere-route-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89) ~[shardingsphere-route-4.1.0.jar:4.1.0]
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76) ~[shardingsphere-route-4.1.0.jar:4.1.0]
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu closed issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy edited a comment on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy edited a comment on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-748741716
@strongduanmu
你好我做了个测试,传递的参数如果为string类型就报下面的错误,如果把类型修正为Date类型则不会报如下错误
代码:
```code
<select id="selectByTime" resultMap="BaseResultMap" parameterType="string">
SELECT <include refid="Base_Column_List"/>
FROM linkman
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
List<Linkman> selectByTime(@Param("createTime") String createTime);
//如果把createTime的类型修改为Date类型则不会报错.
```
```code
[] 2020-12-21 11:44:28.030 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Preparing: SELECT count(0) FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?, '%Y-%m-%d')
[] 2020-12-21 11:44:28.041 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Parameters: 2020-12-21 11:44:27(String)
[] 2020-12-21 11:44:28.575 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : <== Total: 1
[] 2020-12-21 11:44:28.580 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Preparing: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
[] 2020-12-21 11:44:28.581 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Parameters: 2020-12-21 11:44:27(String), 30(Integer)
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy78.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:144)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy80.selectByTime(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy81.selectByTime(Unknown Source)
at org.example.mapper.LinkmanMapperTest.selectByTime(LinkmanMapperTest.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 49 more
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:51)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48)
at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:161)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy95.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:136)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy94.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 55 more
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] KaiRyoung commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
KaiRyoung commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-650830936
I have the same problem
I saw other issues and the display in MySQLStatementParser, version 4.0.0-RC3 does not yet support date_format function
When I tested, it was found that 4.0.1 was used normally, but 4.1.0 would report an error: ClassCastException: java.lang.String cannot be cast to java.lang.Integer
I see that the SQLParserEntry is missing in 4.1.0, maybe this affects the date_format?
this is my sharding configuration:

@strongduanmu
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-929866275
@zhaolin81 This sql has been supported in the master branch, you can try it. Thank you.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-748741716
你好我做了个测试,传递的参数如果为string类型就报下面的错误,如果把类型修正为Date类型则不会报如下错误
代码:
```code
<select id="selectByTime" resultMap="BaseResultMap" parameterType="string">
SELECT <include refid="Base_Column_List"/>
FROM linkman
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
List<Linkman> selectByTime(@Param("createTime") String createTime);
//如果把createTime的类型修改为Date类型则不会报错.
```
```code
[] 2020-12-21 11:44:28.030 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Preparing: SELECT count(0) FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?, '%Y-%m-%d')
[] 2020-12-21 11:44:28.041 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Parameters: 2020-12-21 11:44:27(String)
[] 2020-12-21 11:44:28.575 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : <== Total: 1
[] 2020-12-21 11:44:28.580 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Preparing: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
[] 2020-12-21 11:44:28.581 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Parameters: 2020-12-21 11:44:27(String), 30(Integer)
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy78.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:144)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy80.selectByTime(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy81.selectByTime(Unknown Source)
at org.example.mapper.LinkmanMapperTest.selectByTime(LinkmanMapperTest.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 49 more
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:51)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48)
at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:161)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy95.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:136)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy94.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 55 more
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-650848023
@KaiRyoung Thank you for your reply, I will investigate this issue.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-929866275
@zhaolin81 This sql has been supported in the master branch, you can try it. Thank you.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy removed a comment on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy removed a comment on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-739944865
I have the same problem for date_format on version 4.1.1
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-740533473
@ywendy Can you provide the complete exception stack and your configuration?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-651183778
@KaiRyoung @zhaolin81 Hi, can you try to upgrade to version 4.1.1? I have tried version 4.1.1 with Sharding-Proxy, the `DATE_FORMAT()` function is ok.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-647539540
@zhaolin81 Can you provide sharding configuration and table schema?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] KaiRyoung commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
KaiRyoung commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-651693363
@strongduanmu Hi, I use sharding-jdbc. The function with DATE_FORMAT version 4.1.1 cannot be fragmented, but the 4.0.1 version can be fragmented normally; I mean that the DATE_FORMAT can be fragmented after removing the 4.1.1 version, and it will not work when it is added, my score The slice key is shard_time. The SQL is as follows:
`SELECT
MAX( t.id ) id,
MAX( t.taskid ) taskid,
MAX( t.entid ) entid,
MAX( t.planstime ) planstime,
MAX( t.planetime ) planetime,
MAX( t.gettime ) gettime,
MAX( t.acttime ) acttime,
MAX( t.phone ) phone,
MAX( t.NAME ) NAME,
MAX( t.`call` ) `call`,
MAX( t.duration ) duration,
MAX( t.filename ) filename,
MAX( t.breaknode ) breaknode,
MAX( t.callEndreason ) callEndreason,
MAX( t.adduser ) adduser,
MAX( t.`addtime` ) `addtime`,
MAX( t.state ) state,
MAX( t.weight ) weight,
MAX( t.flag ) flag,
MAX( t.remark ) remark,
MAX( t.artificialweight ) artificialweight,
MAX( t.signread ) signread,
MAX( t.weightlevel ) weightlevel,
MAX( t.shard_time ) shard_time,
MAX( c.purposesum ) score,
MAX( c.switchartificial ) switchArtificial,
MAX( c.switch_artificial_num ) switch_artificial_num,
MAX( c.fwid ) fwid
FROM
ttaskdetail_201906 t
LEFT JOIN t_callinfo c ON t.id = c.taskdeid
WHERE
t.taskid = ?
AND DATE_FORMAT( t.gettime, '%Y-%m-%d' ) >= ?
AND DATE_FORMAT( t.gettime, '%Y-%m-%d' ) <= ?
AND t.`addtime` BETWEEN ?
AND ?
AND t.shard_time BETWEEN ?
AND ?
GROUP BY
t.id
ORDER BY
duration DESC`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] KaiRyoung edited a comment on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
KaiRyoung edited a comment on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-651693363
@strongduanmu Hi, I use sharding-jdbc. The function with DATE_FORMAT version 4.1.1 cannot be fragmented, but the 4.0.1 version can be fragmented normally; I mean that the DATE_FORMAT can be fragmented after removing the 4.1.1 version, and it will not work when it is added, my score The slice key is shard_time. The SQL is as follows:
`SELECT
MAX( t.id ) id,
MAX( t.taskid ) taskid,
MAX( t.entid ) entid,
MAX( t.planstime ) planstime,
MAX( t.planetime ) planetime,
MAX( t.gettime ) gettime,
MAX( t.acttime ) acttime,
MAX( t.phone ) phone,
MAX( t.NAME ) NAME,
MAX( t.`call` ) `call`,
MAX( t.duration ) duration,
MAX( t.filename ) filename,
MAX( t.breaknode ) breaknode,
MAX( t.callEndreason ) callEndreason,
MAX( t.adduser ) adduser,
MAX( t.`addtime` ) `addtime`,
MAX( t.state ) state,
MAX( t.weight ) weight,
MAX( t.flag ) flag,
MAX( t.remark ) remark,
MAX( t.artificialweight ) artificialweight,
MAX( t.signread ) signread,
MAX( t.weightlevel ) weightlevel,
MAX( t.shard_time ) shard_time,
MAX( c.purposesum ) score,
MAX( c.switchartificial ) switchArtificial,
MAX( c.switch_artificial_num ) switch_artificial_num,
MAX( c.fwid ) fwid
FROM
ttaskdetail t
LEFT JOIN t_callinfo c ON t.id = c.taskdeid
WHERE
t.taskid = ?
AND DATE_FORMAT( t.gettime, '%Y-%m-%d' ) >= ?
AND DATE_FORMAT( t.gettime, '%Y-%m-%d' ) <= ?
AND t.`addtime` BETWEEN ?
AND ?
AND t.shard_time BETWEEN ?
AND ?
GROUP BY
t.id
ORDER BY
duration DESC`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] KaiRyoung commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
KaiRyoung commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-651704430
@strongduanmu my last answer may be a bit off topic. According to the ClassCastException caused by DATE_FORMAT(), I couldn’t find the SQL that was reported at the time, so now I am using version 4.0.1, which is good for me Enough.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-739944865
I have the same problem for date_format on version 4.1.1
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu closed issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-929809703
I have checked this sql on master, it's ok. This issue can be closed.
` select * from t_order where DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d') limit ?,?`
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-927249686
@strongduanmu I'll check it on master
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy edited a comment on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy edited a comment on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-748741716
@strongduanmu
版本 4.1.1
你好我做了个测试,传递的参数如果为string类型就报下面的错误,如果把类型修正为Date类型则不会报如下错误
配置:
```yml
spring:
shardingsphere:
encrypt:
encryptors:
aesEncryptor:
type: aes
props:
aes.key.value: 123456
tables:
linkman:
columns:
mobile:
plainColumn: mobile
cipherColumn: mobile_encrypted
encryptor: aesEncryptor
datasource:
names: ds
ds:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://localhost:3306/shardingsphere_test?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
username: root
password: root
connection-timeout: 30000
maximum-pool-size: 20
minimum-idle: 5
auto-commit: true
idle-timeout: 600000
pool-name: crm-hikari
max-lifetime: 1800000
connection-test-query: SELECT 1
props:
query.with.cipher.column: false
```
代码:
```java
<select id="selectByTime" resultMap="BaseResultMap" parameterType="string">
SELECT <include refid="Base_Column_List"/>
FROM linkman
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
List<Linkman> selectByTime(@Param("createTime") String createTime);
//如果把createTime的类型修改为Date类型则不会报错.
```
```code
[] 2020-12-21 11:44:28.030 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Preparing: SELECT count(0) FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?, '%Y-%m-%d')
[] 2020-12-21 11:44:28.041 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : ==> Parameters: 2020-12-21 11:44:27(String)
[] 2020-12-21 11:44:28.575 DEBUG 15556 --- [ main] o.e.m.LinkmanMapper.selectByTime_COUNT : <== Total: 1
[] 2020-12-21 11:44:28.580 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Preparing: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
[] 2020-12-21 11:44:28.581 DEBUG 15556 --- [ main] o.e.mapper.LinkmanMapper.selectByTime : ==> Parameters: 2020-12-21 11:44:27(String), 30(Integer)
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy78.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:144)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy80.selectByTime(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy81.selectByTime(Unknown Source)
at org.example.mapper.LinkmanMapperTest.selectByTime(LinkmanMapperTest.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [D:\workspace\gitsource\shardingsphere-test\target\classes\mapper\LinkmanMapper.xml]
### The error may involve org.example.mapper.LinkmanMapper.selectByTime-Inline
### The error occurred while setting parameters
### SQL: SELECT id, mobile, name, mobile_encrypted, create_time FROM linkman WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(?,'%Y-%m-%d') LIMIT ?
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 49 more
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:51)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38)
at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48)
at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103)
at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:161)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy95.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:136)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy94.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 55 more
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ywendy commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')
Posted by GitBox <gi...@apache.org>.
ywendy commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-739961389
I have the same problem for date_format on version 4.1.1 , when I use sharding-jdbc , debug I found in EncryptStatement class ,the limit Index get error,eg: I have 5 paremeter, the last paremeter is limit value, but the code get Index 2 for limit so throw error!
occur on :
actualRowCount = null == rowCountSegment ? null : getValue(rowCountSegment, parameters);
rowCountSegment.getParameterIndex() ==2 but actual parameters is : 23356,1,'2020-12-07','2020-12-07',10
actual : index should be 4
occur on class : PaginationContext 51 row
now I can use 4.0.1 ,but 4.0.1 -> 4.1.1 are there any more bug? how to solution it! @strongduanmu
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org