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/01/05 03:35:48 UTC

[GitHub] [incubator-shardingsphere] SteNicholas commented on a change in pull request #3868: Part of the shard key in multiple sharding policies can be null

SteNicholas commented on a change in pull request #3868: Part of the shard key in multiple sharding policies can be null
URL: https://github.com/apache/incubator-shardingsphere/pull/3868#discussion_r363067410
 
 

 ##########
 File path: sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/condition/engine/InsertClauseShardingConditionEngine.java
 ##########
 @@ -84,27 +84,40 @@ private ShardingCondition createShardingCondition(final String tableName, final
         for (ExpressionSegment each : insertValueContext.getValueExpressions()) {
             String columnName = columnNames.next();
             if (shardingRule.isShardingColumn(columnName, tableName)) {
-                if (each instanceof SimpleExpressionSegment) {
-                    result.getRouteValues().add(new ListRouteValue<>(columnName, tableName, Collections.singletonList(getRouteValue((SimpleExpressionSegment) each, parameters))));
-                } else if (ExpressionConditionUtils.isNowExpression(each)) {
-                    result.getRouteValues().add(new ListRouteValue<>(columnName, tableName, Collections.singletonList(timeService.getTime())));
+                Comparable<?> routeValue = getRouteValue(each, parameters, timeService);
+                if (null == routeValue) {
 
 Review comment:
   This could judge routeValue is not null, and `result.getRouteValues().add(new ListRouteValue<>(columnName, tableName, Collections.singletonList(routeValue)))` add to if logic, remove the continue.

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


With regards,
Apache Git Services