From c400ccbbf4c79a512aa57d716d761e57fb0d16bf Mon Sep 17 00:00:00 2001 From: duanzhengqiang Date: Wed, 25 Dec 2024 07:59:06 +0800 Subject: [PATCH] fix sonar issue in ColumnDefinitionSegmentBinder and ShardingRuleTest --- .../shardingsphere/sharding/rule/ShardingRuleTest.java | 10 ---------- .../segment/column/ColumnDefinitionSegmentBinder.java | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java index d44a82a11fd41..83429eabfcab7 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java @@ -70,7 +70,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; @@ -739,15 +738,6 @@ private ColumnSegment createColumnSegment(final String columnName, final String return result; } - private Map createColumnTableNameMap() { - Map result = new HashMap<>(4, 1F); - result.put("logic_Table.user_id", "logic_Table"); - result.put("sub_Logic_Table.user_id", "sub_Logic_Table"); - result.put("logic_Table.order_id", "logic_Table"); - result.put("sub_Logic_Table.order_id", "sub_Logic_Table"); - return result; - } - @Test void assertGetDataNodesByTableName() { ShardingRule shardingRule = createMinimumShardingRule(); diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/column/ColumnDefinitionSegmentBinder.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/column/ColumnDefinitionSegmentBinder.java index 633bfd8582171..cffab8116b328 100644 --- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/column/ColumnDefinitionSegmentBinder.java +++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/column/ColumnDefinitionSegmentBinder.java @@ -49,7 +49,7 @@ public static ColumnDefinitionSegment bind(final ColumnDefinitionSegment segment ColumnSegment boundColumnSegment = ColumnSegmentBinder.bind(segment.getColumnName(), SegmentType.DEFINITION_COLUMNS, binderContext, tableBinderContexts, LinkedHashMultimap.create()); ColumnDefinitionSegment result = new ColumnDefinitionSegment(segment.getStartIndex(), segment.getStopIndex(), boundColumnSegment, segment.getDataType(), segment.isPrimaryKey(), segment.isNotNull(), segment.getText()); - copy(segment, result); + copy(result, segment); segment.getReferencedTables().forEach(each -> result.getReferencedTables().add(SimpleTableSegmentBinder.bind(each, binderContext, tableBinderContexts))); return result; }