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 2022/06/28 07:29:50 UTC
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #18647: fix issue-8551
strongduanmu commented on code in PR #18647:
URL: https://github.com/apache/shardingsphere/pull/18647#discussion_r908134137
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/impl/InsertClauseShardingConditionEngine.java:
##########
@@ -109,6 +112,15 @@ private ShardingCondition createShardingCondition(final String tableName, final
return result;
}
+ private void generateShardingCondition(final CommonExpressionSegment expressionSegment, final ShardingCondition result, final String shardingColumn, final String tableName) {
+ try {
+ Integer value = Integer.valueOf(expressionSegment.getText());
+ result.getValues().add(new ListShardingConditionValue<>(shardingColumn, tableName, Collections.singletonList(value)));
+ } catch (NumberFormatException exception) {
Review Comment:
Please rename exception to ex.
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java:
##########
@@ -67,7 +68,11 @@ private boolean isAllowRangeQuery(final Properties props) {
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue) {
Closure<?> closure = createClosure();
- closure.setProperty(shardingValue.getColumnName(), shardingValue.getValue());
+ Comparable<?> value = shardingValue.getValue();
+ if (value instanceof Number) {
+ value = (Comparable<?>) NumberMath.abs((Number) value);
Review Comment:
Can we replace NumberMath.abs with Math.abs?
--
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