-
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
use config SNOWFLAKE Sharding value must implements Comparable #5876
Comments
It's a strange case. Could you post your logic sql and actual sql in you log(sql.show=true)? |
DROP TABLE IF EXISTS ###excute error message Error updating database. Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.The error may exist in file [D:\myworkers\myworkspace\spring-nacos\spring-shanding-db\target\classes\mapper\TransBillExtendsMapper.xml]The error may involve com.bule.spring.dao.OrderShardingMapper.insert-InlineThe error occurred while setting parametersSQL: INSERT INTO t_order ( order_id,order_no, user_id, status,create_date ) VALUES ( ?, ?, ?, ?, ? )Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
Caused by: java.lang.IllegalArgumentException: Sharding value must implements Comparable. |
The problem maybe cause by |
What is the type create_date in your java data class? @ljz0721cx |
@ljz0721cx ok,i know your data class now. |
Ok run test class TestOrderShardingMapper |
your repo is private. |
your project has no sharding-sphere config or dependency. |
I have the same Error。(The version of the shardingphere-jdbc is 4.1.1)
The first of the parameters is id and the value is null then cause the error. |
Bug Report
insert data but not accept below
Sharding value must implements Comparable
DROP TABLE IF EXISTS
t_order1
;CREATE TABLE
t_order0
(order_id
bigint(20) NULL DEFAULT NULL COMMENT '订单id',order_no
bigint(20) NOT NULL COMMENT '订单号',user_id
int(20) NULL DEFAULT NULL COMMENT '用户id',status
varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci NULL DEFAULT NULL COMMENT '状态码',create_date
datetime(0) NULL DEFAULT NULL,PRIMARY KEY (
order_no
) USING BTREE) ENGINE = InnoDB CHARACTER SET = big5 COLLATE = big5_chinese_ci ROW_FORMAT = Compact;
###excute error message
Error updating database. Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
The error may exist in file [D:\myworkers\myworkspace\spring-nacos\spring-shanding-db\target\classes\mapper\TransBillExtendsMapper.xml]
The error may involve com.bule.spring.dao.OrderShardingMapper.insert-Inline
The error occurred while setting parameters
SQL: INSERT INTO t_order ( order_id,order_no, user_id, status,create_date ) VALUES ( ?, ?, ?, ?, ? )
Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
Caused by: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.getRouteValue(InsertClauseShardingConditionEngine.java:112)
at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.createShardingCondition(InsertClauseShardingConditionEngine.java:94)
at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.createShardingConditions(InsertClauseShardingConditionEngine.java:65)
at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.getShardingConditions(ShardingRouteDecorator.java:80)
at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:62)
at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:53)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:91)
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.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:143)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 43 more
Which version of ShardingSphere did you use?
org.apache.shardingsphere sharding-jdbc-spring-boot-starter 4.1.0Which project did you use? Sharding-JDBC or Sharding-Proxy?
Sharding-JDBC
Expected behavior
SNOWFLAKE config can effect
Actual behavior
Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
Reason analyze (If you can)
when insert can not bind genrate sharding value
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).
The text was updated successfully, but these errors were encountered: