This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a6eb461586 Refactor DataNode's constructor (#36949)
5a6eb461586 is described below

commit 5a6eb4615869b3a1628dc6111605e001a43214b9
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Oct 27 23:34:26 2025 +0800

    Refactor DataNode's constructor (#36949)
    
    * Refactor DataNode's constructor
    
    * Refactor DataNode's constructor
---
 .../attribute/BroadcastDataNodeRuleAttribute.java  |  2 +-
 .../cache/route/cache/ShardingRouteCacheValue.java | 10 +--
 .../type/standard/ShardingStandardRouteEngine.java |  2 +-
 .../sharding/rule/ShardingTable.java               |  4 +-
 .../cache/route/CachedShardingSQLRouterTest.java   |  6 +-
 .../decider/ShardingSQLFederationDeciderTest.java  |  4 +-
 .../constraint/ShardingConstraintReviserTest.java  |  2 +-
 .../reviser/index/ShardingIndexReviserTest.java    |  2 +-
 .../ShardingInsertValuesTokenGeneratorTest.java    |  2 +-
 .../token/pojo/ShardingInsertValuesTokenTest.java  |  6 +-
 .../dml/ShardingInsertRouteContextCheckerTest.java | 10 +--
 .../sharding/rule/ShardingTableTest.java           | 40 ++++-----
 .../shardingsphere/infra/datanode/DataNode.java    |  8 +-
 .../infra/datanode/DataNodeUtils.java              |  2 +-
 .../infra/datanode/DataNodeTest.java               | 96 +++++-----------------
 .../infra/datanode/DataNodesTest.java              |  6 +-
 .../data/pipeline/core/datanode/DataNodeUtils.java |  2 +-
 .../datanode/JobDataNodeLineConvertUtilsTest.java  |  7 +-
 .../decider/SingleSQLFederationDeciderTest.java    |  8 +-
 .../InUsedSingleStorageUnitRetrieverTest.java      |  2 +-
 .../query/ShowSingleTablesExecutorTest.java        |  4 +-
 .../migration/api/MigrationJobAPITest.java         |  6 +-
 22 files changed, 82 insertions(+), 149 deletions(-)

diff --git 
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/attribute/BroadcastDataNodeRuleAttribute.java
 
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/attribute/BroadcastDataNodeRuleAttribute.java
index 83e9bb92433..a1d4749f0a2 100644
--- 
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/attribute/BroadcastDataNodeRuleAttribute.java
+++ 
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/attribute/BroadcastDataNodeRuleAttribute.java
@@ -41,7 +41,7 @@ public final class BroadcastDataNodeRuleAttribute implements 
DataNodeRuleAttribu
     }
     
     private Collection<DataNode> generateDataNodes(final String logicTable, 
final Collection<String> dataSourceNames) {
-        return dataSourceNames.stream().map(each -> new DataNode(each, 
logicTable)).collect(Collectors.toList());
+        return dataSourceNames.stream().map(each -> new DataNode(each, 
(String) null, logicTable)).collect(Collectors.toList());
     }
     
     @Override
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
index 97686083c9f..fb1961a5bae 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
@@ -29,6 +29,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * Value of sharding route cache.
@@ -64,14 +65,7 @@ public final class ShardingRouteCacheValue {
     private Collection<Collection<DataNode>> deepCopyOriginalDataNodes() {
         Collection<Collection<DataNode>> result = new 
ArrayList<>(cachedRouteContext.getOriginalDataNodes().size());
         for (Collection<DataNode> eachDataNodes : 
cachedRouteContext.getOriginalDataNodes()) {
-            Collection<DataNode> eachResult = new 
ArrayList<>(eachDataNodes.size());
-            // TODO This could be simplified if all fields of DataNode were 
immutable
-            for (DataNode each : eachDataNodes) {
-                DataNode copiedDataNode = new 
DataNode(each.getDataSourceName(), each.getTableName());
-                copiedDataNode.setSchemaName(each.getSchemaName());
-                eachResult.add(copiedDataNode);
-            }
-            result.add(eachResult);
+            result.add(eachDataNodes.stream().map(each -> new 
DataNode(each.getDataSourceName(), each.getSchemaName(), 
each.getTableName())).collect(Collectors.toList()));
         }
         return result;
     }
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/standard/ShardingStandardRouteEngine.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/standard/ShardingStandardRouteEngine.java
index ad6dcd0765b..b264ba22c9d 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/standard/ShardingStandardRouteEngine.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/standard/ShardingStandardRouteEngine.java
@@ -274,7 +274,7 @@ public final class ShardingStandardRouteEngine implements 
ShardingRouteEngine {
                 : tableShardingStrategy.doSharding(availableTargetTables, 
tableShardingValues, shardingTable.getTableDataNode(), props);
         Collection<DataNode> result = new LinkedList<>();
         for (String each : routedTables) {
-            result.add(new DataNode(routedDataSource, each));
+            result.add(new DataNode(routedDataSource, (String) null, each));
         }
         return result;
     }
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingTable.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingTable.java
index 1b764b81eab..e6f4e1cb5da 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingTable.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingTable.java
@@ -174,7 +174,7 @@ public final class ShardingTable {
         List<DataNode> result = new ArrayList<>(dataSourceNames.size());
         int index = 0;
         for (String each : dataSourceNames) {
-            DataNode dataNode = new DataNode(each, logicTable);
+            DataNode dataNode = new DataNode(each, (String) null, logicTable);
             result.add(dataNode);
             dataNodeIndexMap.put(dataNode, index);
             actualDataSourceNames.add(each);
@@ -228,7 +228,7 @@ public final class ShardingTable {
      * @return actual table index
      */
     public int findActualTableIndex(final String dataSourceName, final String 
actualTableName) {
-        return dataNodeIndexMap.getOrDefault(new DataNode(dataSourceName, 
actualTableName), -1);
+        return dataNodeIndexMap.getOrDefault(new DataNode(dataSourceName, 
(String) null, actualTableName), -1);
     }
     
     /**
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
index 491a78a65bd..acea07af0dc 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
@@ -117,7 +117,7 @@ class CachedShardingSQLRouterTest {
         
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
         RouteContext expected = new RouteContext();
         expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", (String) null, "t")));
         
when(shardingCache.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.empty());
         OriginSQLRouter router = (unused, globalRuleMetaData, database, rule, 
tableNames, props) -> expected;
         Collection<String> tableNames = Collections.singletonList("t");
@@ -137,7 +137,7 @@ class CachedShardingSQLRouterTest {
         
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
         RouteContext expected = new RouteContext();
         expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", (String) null, "t")));
         
when(shardingCache.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.of(new
 ShardingRouteCacheValue(expected)));
         Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(null, queryContext, 
mock(RuleMetaData.class), null, shardingCache, Collections.singletonList("t"), 
null);
         assertTrue(actual.isPresent());
@@ -157,7 +157,7 @@ class CachedShardingSQLRouterTest {
         
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
         RouteContext expected = new RouteContext();
         expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Arrays.asList(new RouteMapper("t", "t_0"), new RouteMapper("t", 
"t_1"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t_0")));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", (String) null, "t_0")));
         OriginSQLRouter router = (unused, globalRuleMetaData, database, rule, 
tableNames, props) -> expected;
         RuleMetaData globalRuleMetaData = mock(RuleMetaData.class);
         Collection<String> tableNames = Collections.singletonList("t");
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/decider/ShardingSQLFederationDeciderTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/decider/ShardingSQLFederationDeciderTest.java
index b3c1e2d4642..0b9055a5ff5 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/decider/ShardingSQLFederationDeciderTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/decider/ShardingSQLFederationDeciderTest.java
@@ -202,8 +202,8 @@ class ShardingSQLFederationDeciderTest {
         ShardingRule result = mock(ShardingRule.class, RETURNS_DEEP_STUBS);
         when(result.getShardingLogicTableNames(Arrays.asList("foo_tbl", 
"bar_tbl"))).thenReturn(Arrays.asList("foo_tbl", "bar_tbl"));
         DataNodeRuleAttribute dataNodeRuleAttribute = 
mock(DataNodeRuleAttribute.class);
-        
when(dataNodeRuleAttribute.getDataNodesByTableName("foo_tbl")).thenReturn(Arrays.asList(new
 DataNode("ds_0", "foo_tbl"), new DataNode("ds_1", "foo_tbl")));
-        
when(dataNodeRuleAttribute.getDataNodesByTableName("bar_tbl")).thenReturn(Arrays.asList(new
 DataNode("ds_0", "bar_tbl"), new DataNode("ds_1", "bar_tbl")));
+        
when(dataNodeRuleAttribute.getDataNodesByTableName("foo_tbl")).thenReturn(Arrays.asList(new
 DataNode("ds_0", (String) null, "foo_tbl"), new DataNode("ds_1", (String) 
null, "foo_tbl")));
+        
when(dataNodeRuleAttribute.getDataNodesByTableName("bar_tbl")).thenReturn(Arrays.asList(new
 DataNode("ds_0", (String) null, "bar_tbl"), new DataNode("ds_1", (String) 
null, "bar_tbl")));
         when(result.getAttributes()).thenReturn(new 
RuleAttributes(dataNodeRuleAttribute));
         
when(result.findShardingTable("foo_tbl")).thenReturn(Optional.of(mock(ShardingTable.class)));
         
when(result.findShardingTable("bar_tbl")).thenReturn(Optional.of(mock(ShardingTable.class)));
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/constraint/ShardingConstraintReviserTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/constraint/ShardingConstraintReviserTest.java
index c9d98507bd0..885b9c604bd 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/constraint/ShardingConstraintReviserTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/constraint/ShardingConstraintReviserTest.java
@@ -49,7 +49,7 @@ class ShardingConstraintReviserTest {
     void setUp() {
         shardingRule = createShardingRule();
         ShardingTable shardingTable = mock(ShardingTable.class);
-        when(shardingTable.getActualDataNodes()).thenReturn(Arrays.asList(new 
DataNode("schema_name", "table_name_0"), new DataNode("schema_name", 
"table_name_1")));
+        when(shardingTable.getActualDataNodes()).thenReturn(Arrays.asList(new 
DataNode("schema_name", (String) null, "table_name_0"), new 
DataNode("schema_name", (String) null, "table_name_1")));
         reviser = new ShardingConstraintReviser(shardingTable);
     }
     
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/index/ShardingIndexReviserTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/index/ShardingIndexReviserTest.java
index 96704f2dbd2..4eed14ad788 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/index/ShardingIndexReviserTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/metadata/reviser/index/ShardingIndexReviserTest.java
@@ -50,7 +50,7 @@ class ShardingIndexReviserTest {
     
     private static ShardingTable mockShardingTable() {
         ShardingTable result = mock(ShardingTable.class);
-        when(result.getActualDataNodes()).thenReturn(Arrays.asList(new 
DataNode("foo_schema", "tbl_0"), new DataNode("foo_schema", "tbl_1")));
+        when(result.getActualDataNodes()).thenReturn(Arrays.asList(new 
DataNode("foo_schema", (String) null, "tbl_0"), new DataNode("foo_schema", 
(String) null, "tbl_1")));
         return result;
     }
 }
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ShardingInsertValuesTokenGeneratorTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ShardingInsertValuesTokenGeneratorTest.java
index 9e3d84c1fc1..84fa1dfeabe 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ShardingInsertValuesTokenGeneratorTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/ShardingInsertValuesTokenGeneratorTest.java
@@ -73,7 +73,7 @@ class ShardingInsertValuesTokenGeneratorTest {
     @Test
     void assertGenerateSQLTokenWithDataNodes() {
         RouteContext routeContext = new RouteContext();
-        routeContext.getOriginalDataNodes().add(Collections.singleton(new 
DataNode("foo_ds", "foo_tbl")));
+        routeContext.getOriginalDataNodes().add(Collections.singleton(new 
DataNode("foo_ds", (String) null, "foo_tbl")));
         generator.setRouteContext(routeContext);
         InsertValuesToken actual = 
generator.generateSQLToken(mockInsertStatementContext());
         ShardingInsertValue actualInsertValue = (ShardingInsertValue) 
actual.getInsertValues().get(0);
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ShardingInsertValuesTokenTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ShardingInsertValuesTokenTest.java
index f4cc7f2b59c..637dc4aa786 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ShardingInsertValuesTokenTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ShardingInsertValuesTokenTest.java
@@ -43,7 +43,7 @@ class ShardingInsertValuesTokenTest {
     
     private ShardingInsertValuesToken createInsertValuesToken() {
         ShardingInsertValuesToken result = new ShardingInsertValuesToken(0, 2);
-        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", "tbl_0"));
+        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", (String) null, "tbl_0"));
         List<ExpressionSegment> values = Arrays.asList(new 
LiteralExpressionSegment(0, 0, "foo"), new LiteralExpressionSegment(0, 0, 
"bar"));
         result.getInsertValues().add(new ShardingInsertValue(values, 
dataNodes));
         return result;
@@ -63,7 +63,7 @@ class ShardingInsertValuesTokenTest {
     
     private ShardingInsertValuesToken createMultipleInsertValuesToken() {
         ShardingInsertValuesToken result = new ShardingInsertValuesToken(0, 2);
-        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", "tbl_0"));
+        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", (String) null, "tbl_0"));
         List<ExpressionSegment> values = Arrays.asList(new 
LiteralExpressionSegment(0, 0, "foo"), new LiteralExpressionSegment(0, 0, 
"bar"));
         result.getInsertValues().add(new ShardingInsertValue(values, 
dataNodes));
         result.getInsertValues().add(new ShardingInsertValue(values, 
dataNodes));
@@ -73,7 +73,7 @@ class ShardingInsertValuesTokenTest {
     @Test
     void assertToStringWithEmptyInsertValues() {
         ShardingInsertValuesToken result = new ShardingInsertValuesToken(0, 2);
-        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", "tbl_0"));
+        Collection<DataNode> dataNodes = Collections.singleton(new 
DataNode("foo_ds", (String) null, "tbl_0"));
         List<ExpressionSegment> values = Collections.emptyList();
         assertThrows(UnsupportedSQLOperationException.class, () -> 
result.getInsertValues().add(new ShardingInsertValue(values, dataNodes)));
     }
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/checker/dml/ShardingInsertRouteContextCheckerTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/checker/dml/ShardingInsertRouteContextCheckerTest.java
index 3875ee3efa4..fd544ada48c 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/checker/dml/ShardingInsertRouteContextCheckerTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/checker/dml/ShardingInsertRouteContextCheckerTest.java
@@ -187,10 +187,10 @@ class ShardingInsertRouteContextCheckerTest {
     
     private Collection<Collection<DataNode>> getMultipleRouteDataNodes() {
         Collection<DataNode> value1DataNodes = new LinkedList<>();
-        value1DataNodes.add(new DataNode("ds_0", "user_0"));
+        value1DataNodes.add(new DataNode("ds_0", (String) null, "user_0"));
         Collection<DataNode> value2DataNodes = new LinkedList<>();
-        value2DataNodes.add(new DataNode("ds_0", "user_0"));
-        value2DataNodes.add(new DataNode("ds_0", "user_1"));
+        value2DataNodes.add(new DataNode("ds_0", (String) null, "user_0"));
+        value2DataNodes.add(new DataNode("ds_0", (String) null, "user_1"));
         Collection<Collection<DataNode>> result = new LinkedList<>();
         result.add(value1DataNodes);
         result.add(value2DataNodes);
@@ -199,9 +199,9 @@ class ShardingInsertRouteContextCheckerTest {
     
     private Collection<Collection<DataNode>> getSingleRouteDataNodes() {
         Collection<DataNode> value1DataNodes = new LinkedList<>();
-        value1DataNodes.add(new DataNode("ds_0", "user_0"));
+        value1DataNodes.add(new DataNode("ds_0", (String) null, "user_0"));
         Collection<DataNode> value2DataNodes = new LinkedList<>();
-        value2DataNodes.add(new DataNode("ds_0", "user_0"));
+        value2DataNodes.add(new DataNode("ds_0", (String) null, "user_0"));
         Collection<Collection<DataNode>> result = new LinkedList<>();
         result.add(value1DataNodes);
         result.add(value2DataNodes);
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingTableTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingTableTest.java
index 897cc1ce13f..0c53e38435c 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingTableTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingTableTest.java
@@ -54,8 +54,8 @@ class ShardingTableTest {
         ShardingTable actual = new ShardingTable(shardingTableRuleConfig, 
Arrays.asList("ds0", "ds1"), null);
         assertThat(actual.getLogicTable(), is("LOGIC_TABLE"));
         assertThat(actual.getActualDataNodes().size(), is(2));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"LOGIC_TABLE")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"LOGIC_TABLE")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "LOGIC_TABLE")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "LOGIC_TABLE")));
     }
     
     @Test
@@ -67,12 +67,12 @@ class ShardingTableTest {
         ShardingTable actual = new ShardingTable(shardingTableRuleConfig, 
Arrays.asList("ds0", "ds1"), null);
         assertThat(actual.getLogicTable(), is("LOGIC_TABLE"));
         assertThat(actual.getActualDataNodes().size(), is(6));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"table_0")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"table_1")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"table_2")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"table_0")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"table_1")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"table_2")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "table_1")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "table_2")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "table_1")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "table_2")));
         assertTrue(actual.getGenerateKeyColumn().isPresent());
         assertThat(actual.getGenerateKeyColumn().get(), is("col_1"));
         assertThat(actual.getKeyGeneratorName(), is("increment"));
@@ -86,10 +86,10 @@ class ShardingTableTest {
         ShardingTable actual = new ShardingTable(shardingAutoTableRuleConfig, 
Arrays.asList("ds0", "ds1", "ds2"), shardingAlgorithm, null);
         assertThat(actual.getLogicTable(), is("LOGIC_TABLE"));
         assertThat(actual.getActualDataNodes().size(), is(4));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"logic_table_0")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"logic_table_1")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"logic_table_2")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"logic_table_3")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "logic_table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "logic_table_1")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "logic_table_2")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "logic_table_3")));
     }
     
     @Test
@@ -100,10 +100,10 @@ class ShardingTableTest {
         ShardingTable actual = new ShardingTable(shardingAutoTableRuleConfig, 
Arrays.asList("ds0", "ds1", "ds2"), shardingAlgorithm, null);
         assertThat(actual.getLogicTable(), is("LOGIC_TABLE"));
         assertThat(actual.getActualDataNodes().size(), is(4));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"logic_table_0")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"logic_table_1")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds2", 
"logic_table_2")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"logic_table_3")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "logic_table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "logic_table_1")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds2", 
(String) null, "logic_table_2")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "logic_table_3")));
     }
     
     @Test
@@ -160,8 +160,8 @@ class ShardingTableTest {
         ShardingTable shardingTable = new ShardingTable(dataSourceNames, 
logicTableName);
         Map<String, List<DataNode>> actual = shardingTable.getDataNodeGroups();
         assertThat(actual.size(), is(2));
-        assertTrue(actual.get("ds0").contains(new DataNode("ds0", "table_0")));
-        assertTrue(actual.get("ds1").contains(new DataNode("ds1", "table_0")));
+        assertTrue(actual.get("ds0").contains(new DataNode("ds0", (String) 
null, "table_0")));
+        assertTrue(actual.get("ds1").contains(new DataNode("ds1", (String) 
null, "table_0")));
     }
     
     @Test
@@ -172,8 +172,8 @@ class ShardingTableTest {
         dataSourceNames.add("ds1");
         ShardingTable actual = new ShardingTable(dataSourceNames, 
logicTableName);
         assertThat(actual.getActualDataNodes().size(), is(2));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
"table_0")));
-        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
"table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", 
(String) null, "table_0")));
+        assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", 
(String) null, "table_0")));
     }
     
     @Test
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNode.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNode.java
index f67aaf8c337..19bccb4b8c6 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNode.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNode.java
@@ -20,10 +20,8 @@ package org.apache.shardingsphere.infra.datanode;
 import com.cedarsoftware.util.CaseInsensitiveMap.CaseInsensitiveString;
 import com.google.common.base.Objects;
 import com.google.common.base.Splitter;
-import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import lombok.Setter;
 import lombok.ToString;
 import 
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
 import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
@@ -36,10 +34,8 @@ import java.util.List;
 /**
  * Data node.
  */
-@AllArgsConstructor
 @RequiredArgsConstructor
 @Getter
-@Setter
 @ToString
 public final class DataNode {
     
@@ -49,8 +45,7 @@ public final class DataNode {
     
     private final String dataSourceName;
     
-    // TODO add final for schemaName
-    private String schemaName;
+    private final String schemaName;
     
     private final String tableName;
     
@@ -64,6 +59,7 @@ public final class DataNode {
         List<String> segments = Splitter.on(DELIMITER).splitToList(dataNode);
         boolean isIncludeInstance = 3 == segments.size();
         dataSourceName = isIncludeInstance ? segments.get(0) + DELIMITER + 
segments.get(1) : segments.get(0);
+        schemaName = null;
         tableName = segments.get(isIncludeInstance ? 2 : 1);
     }
     
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNodeUtils.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNodeUtils.java
index 9c7e2de4272..6be6264dca5 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNodeUtils.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/datanode/DataNodeUtils.java
@@ -61,7 +61,7 @@ public final class DataNodeUtils {
         }
         Collection<DataNode> result = new LinkedList<>();
         for (String each : dataSources.get(dataNode.getDataSourceName())) {
-            result.add(new DataNode(each, dataNode.getTableName()));
+            result.add(new DataNode(each, (String) null, 
dataNode.getTableName()));
         }
         return result;
     }
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
index ba691e0664e..97b13ba0c1f 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
@@ -59,7 +59,7 @@ class DataNodeTest {
     
     @Test
     void assertFormatWithoutSchema() {
-        DataNode dataNode = new DataNode("foo_ds", "foo_tbl");
+        DataNode dataNode = new DataNode("foo_ds", (String) null, "foo_tbl");
         assertThat(dataNode.format(), is("foo_ds.foo_tbl"));
     }
     
@@ -67,20 +67,34 @@ class DataNodeTest {
     @Test
     void assertEquals() {
         DataNode dataNode = new DataNode("ds_0.tbl_0");
-        assertThat(dataNode, is(new DataNode("ds_0.tbl_0")));
         assertThat(dataNode, is(dataNode));
+        assertThat(dataNode, is(new DataNode("ds_0.tbl_0")));
+        assertThat(dataNode, is(new DataNode("DS_0.TBL_0")));
         assertThat(dataNode, not(new DataNode("ds_0.tbl_1")));
+        assertThat(dataNode.equals("ds.tbl"), is(false));
         assertFalse(dataNode.equals(null));
     }
     
+    @Test
+    void assertEqualsWithSchema() {
+        DataNode dataNode = new DataNode("ds", "schema1", "tbl");
+        assertThat(dataNode, not(new DataNode("ds", "schema2", "tbl")));
+        assertThat(dataNode, not(new DataNode("ds", (String) null, "tbl")));
+    }
+    
     @Test
     void assertHashCode() {
         assertThat(new DataNode("ds_0.tbl_0").hashCode(), is(new 
DataNode("ds_0.tbl_0").hashCode()));
+        assertThat(new DataNode("ds_0.tbl_0").hashCode(), is(new 
DataNode("DS_0.TBL_0").hashCode()));
+        assertThat(new DataNode("ds_0.db_0.tbl_0").hashCode(), is(new 
DataNode("ds_0.db_0.tbl_0").hashCode()));
+        assertThat(new DataNode("ds_0.db_0.tbl_0").hashCode(), is(new 
DataNode("DS_0.DB_0.TBL_0").hashCode()));
     }
     
     @Test
     void assertToString() {
         assertThat(new DataNode("ds_0.tbl_0").toString(), 
is("DataNode(dataSourceName=ds_0, schemaName=null, tableName=tbl_0)"));
+        assertThat(new DataNode("ds", "schema", "tbl").toString(), 
is("DataNode(dataSourceName=ds, schemaName=schema, tableName=tbl)"));
+        assertThat(new DataNode("ds_0.db_0.tbl_0").toString(), 
is("DataNode(dataSourceName=ds_0.db_0, schemaName=null, tableName=tbl_0)"));
     }
     
     @Test
@@ -100,16 +114,6 @@ class DataNodeTest {
         assertThat(dataNode.getTableName(), is("tbl_0"));
     }
     
-    @Test
-    void assertHashCodeIncludeInstance() {
-        assertThat(new DataNode("ds_0.db_0.tbl_0").hashCode(), is(new 
DataNode("ds_0.db_0.tbl_0").hashCode()));
-    }
-    
-    @Test
-    void assertToStringIncludeInstance() {
-        assertThat(new DataNode("ds_0.db_0.tbl_0").toString(), 
is("DataNode(dataSourceName=ds_0.db_0, schemaName=null, tableName=tbl_0)"));
-    }
-    
     @Test
     void assertNewDataNodeWithOnlyOneSegment() {
         assertThrows(InvalidDataNodeFormatException.class, () -> new 
DataNode("ds_0"));
@@ -218,31 +222,10 @@ class DataNodeTest {
     
     @Test
     void assertFormatWithDatabaseTypeWithoutSchema() {
-        DataNode dataNode = new DataNode("ds", "tbl");
+        DataNode dataNode = new DataNode("ds", (String) null, "tbl");
         
assertThat(dataNode.format(TypedSPILoader.getService(DatabaseType.class, 
"MySQL")), is("ds.tbl"));
     }
     
-    @Test
-    void assertEqualsCaseInsensitive() {
-        DataNode dataNode1 = new DataNode("DS", "SCHEMA", "TBL");
-        DataNode dataNode2 = new DataNode("ds", "schema", "tbl");
-        assertThat(dataNode1, is(dataNode2));
-    }
-    
-    @Test
-    void assertEqualsWithDifferentSchema() {
-        DataNode dataNode1 = new DataNode("ds", "schema1", "tbl");
-        DataNode dataNode2 = new DataNode("ds", "schema2", "tbl");
-        assertThat(dataNode1, not(dataNode2));
-    }
-    
-    @Test
-    void assertEqualsWithOneNullSchema() {
-        DataNode dataNode1 = new DataNode("ds", "schema", "tbl");
-        DataNode dataNode2 = new DataNode("ds", "tbl");
-        assertThat(dataNode1, not(dataNode2));
-    }
-    
     @Test
     void assertNewDataNodeWithDatabaseTypeWithoutSchemaSupport() {
         DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
@@ -266,60 +249,19 @@ class DataNodeTest {
         assertThrows(InvalidDataNodeFormatException.class, () -> new 
DataNode("test_db", databaseType, "invalid_format_without_delimiter"));
     }
     
-    @Test
-    void assertHashCodeWithSchema() {
-        DataNode dataNode1 = new DataNode("DS", "SCHEMA", "TBL");
-        DataNode dataNode2 = new DataNode("ds", "schema", "tbl");
-        assertThat(dataNode1.hashCode(), is(dataNode2.hashCode()));
-    }
-    
-    @Test
-    void assertHashCodeWithNullSchema() {
-        DataNode dataNode1 = new DataNode("ds", "tbl");
-        DataNode dataNode2 = new DataNode("ds", "tbl");
-        assertThat(dataNode1.hashCode(), is(dataNode2.hashCode()));
-    }
-    
-    @Test
-    void assertEqualsWithNullSchemas() {
-        DataNode dataNode1 = new DataNode("ds", "tbl");
-        DataNode dataNode2 = new DataNode("ds", "tbl");
-        assertThat(dataNode1, is(dataNode2));
-    }
-    
     @Test
     void assertFormatWithDatabaseTypeAndNullSchema() {
         DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "PostgreSQL");
-        DataNode dataNode = new DataNode("ds", "tbl");
+        DataNode dataNode = new DataNode("ds", (String) null, "tbl");
         assertThat(dataNode.format(databaseType), is("ds.tbl"));
     }
     
     @Test
     void assertFormatWithoutSchemaType() {
-        DataNode dataNode = new DataNode("ds", "tbl");
+        DataNode dataNode = new DataNode("ds", (String) null, "tbl");
         
assertThat(dataNode.format(TypedSPILoader.getService(DatabaseType.class, 
"MySQL")), is("ds.tbl"));
     }
     
-    @Test
-    void assertEqualsWithDifferentClass() {
-        DataNode dataNode = new DataNode("ds.tbl");
-        assertThat(dataNode.equals("ds.tbl"), is(false));
-        assertThat(dataNode.equals(null), is(false));
-    }
-    
-    @Test
-    void assertHashCodeConsistency() {
-        DataNode dataNode1 = new DataNode("DS", "SCHEMA", "TBL");
-        DataNode dataNode2 = new DataNode("ds", "schema", "tbl");
-        assertThat(dataNode1.hashCode(), is(dataNode2.hashCode()));
-    }
-    
-    @Test
-    void assertToStringWithSchema() {
-        DataNode dataNode = new DataNode("ds", "schema", "tbl");
-        assertThat(dataNode.toString(), is("DataNode(dataSourceName=ds, 
schemaName=schema, tableName=tbl)"));
-    }
-    
     @Test
     void assertFormatMethodWithTableNameLowercasing() {
         DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "PostgreSQL");
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodesTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodesTest.java
index 1ed9397f2e4..48231afe2ef 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodesTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodesTest.java
@@ -152,7 +152,7 @@ class DataNodesTest {
     
     private ShardingSphereRule mockSingleRule() {
         DataNodeRuleAttribute ruleAttribute = 
mock(DataNodeRuleAttribute.class);
-        
when(ruleAttribute.getDataNodesByTableName("t_single")).thenReturn(Collections.singleton(new
 DataNode("readwrite_ds", "t_single")));
+        
when(ruleAttribute.getDataNodesByTableName("t_single")).thenReturn(Collections.singleton(new
 DataNode("readwrite_ds", (String) null, "t_single")));
         ShardingSphereRule result = mock(ShardingSphereRule.class);
         when(result.getAttributes()).thenReturn(new 
RuleAttributes(ruleAttribute));
         return result;
@@ -160,8 +160,8 @@ class DataNodesTest {
     
     private ShardingSphereRule mockShardingRule() {
         Collection<DataNode> dataNodes = new LinkedList<>();
-        dataNodes.add(new DataNode("readwrite_ds", "t_order_0"));
-        dataNodes.add(new DataNode("readwrite_ds", "t_order_1"));
+        dataNodes.add(new DataNode("readwrite_ds", (String) null, 
"t_order_0"));
+        dataNodes.add(new DataNode("readwrite_ds", (String) null, 
"t_order_1"));
         DataNodeRuleAttribute ruleAttribute = 
mock(DataNodeRuleAttribute.class);
         
when(ruleAttribute.getDataNodesByTableName("t_order")).thenReturn(dataNodes);
         ShardingSphereRule result = mock(ShardingSphereRule.class);
diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datanode/DataNodeUtils.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datanode/DataNodeUtils.java
index 8bb575967b5..bce185c655b 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datanode/DataNodeUtils.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/datanode/DataNodeUtils.java
@@ -42,6 +42,6 @@ public final class DataNodeUtils {
     public static DataNode parseWithSchema(final String text) {
         List<String> segments = Splitter.on(".").splitToList(text);
         ShardingSpherePreconditions.checkState(2 == segments.size() || 3 == 
segments.size(), () -> new InvalidDataNodeFormatException(text));
-        return 3 == segments.size() ? new DataNode(segments.get(0), 
segments.get(1), segments.get(2)) : new DataNode(segments.get(0), 
segments.get(segments.size() - 1));
+        return 3 == segments.size() ? new DataNode(segments.get(0), 
segments.get(1), segments.get(2)) : new DataNode(segments.get(0), (String) 
null, segments.get(segments.size() - 1));
     }
 }
diff --git 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datanode/JobDataNodeLineConvertUtilsTest.java
 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datanode/JobDataNodeLineConvertUtilsTest.java
index 19f9b37ef39..705fe80bd8e 100644
--- 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datanode/JobDataNodeLineConvertUtilsTest.java
+++ 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datanode/JobDataNodeLineConvertUtilsTest.java
@@ -36,8 +36,8 @@ class JobDataNodeLineConvertUtilsTest {
     @Test
     void assertConvertDataNodesToLines() {
         Map<String, List<DataNode>> mockedTableAndDataNodesMap = new 
LinkedHashMap<>(2, 1F);
-        List<DataNode> dataNodes = Arrays.asList(new DataNode("ds_0", 
"t_order_0"), new DataNode("ds_0", "t_order_1"));
-        List<DataNode> itemDataNodes = Collections.singletonList(new 
DataNode("ds_0", "t_order_item_0"));
+        List<DataNode> dataNodes = Arrays.asList(new DataNode("ds_0", (String) 
null, "t_order_0"), new DataNode("ds_0", (String) null, "t_order_1"));
+        List<DataNode> itemDataNodes = Collections.singletonList(new 
DataNode("ds_0", (String) null, "t_order_item_0"));
         mockedTableAndDataNodesMap.put("t_order", dataNodes);
         mockedTableAndDataNodesMap.put("t_order_item", itemDataNodes);
         List<JobDataNodeLine> jobDataNodeLines = 
JobDataNodeLineConvertUtils.convertDataNodesToLines(mockedTableAndDataNodesMap);
@@ -51,7 +51,8 @@ class JobDataNodeLineConvertUtilsTest {
     
     @Test
     void assertConvertDataNodesToLinesWithMultipleDataSource() {
-        List<DataNode> dataNodes = Arrays.asList(new DataNode("ds_0", 
"t_order_0"), new DataNode("ds_0", "t_order_2"), new DataNode("ds_1", 
"t_order_1"), new DataNode("ds_1", "t_order_3"));
+        List<DataNode> dataNodes = Arrays.asList(new DataNode("ds_0", (String) 
null, "t_order_0"),
+                new DataNode("ds_0", (String) null, "t_order_2"), new 
DataNode("ds_1", (String) null, "t_order_1"), new DataNode("ds_1", (String) 
null, "t_order_3"));
         List<JobDataNodeLine> jobDataNodeLines = 
JobDataNodeLineConvertUtils.convertDataNodesToLines(Collections.singletonMap("t_order",
 dataNodes));
         assertThat(jobDataNodeLines.size(), is(2));
         JobDataNodeEntry jobDataNodeEntry = 
jobDataNodeLines.get(0).getEntries().iterator().next();
diff --git 
a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/decider/SingleSQLFederationDeciderTest.java
 
b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/decider/SingleSQLFederationDeciderTest.java
index 8145bf5dba7..5ad572966ef 100644
--- 
a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/decider/SingleSQLFederationDeciderTest.java
+++ 
b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/decider/SingleSQLFederationDeciderTest.java
@@ -81,7 +81,7 @@ class SingleSQLFederationDeciderTest {
         Collection<QualifiedTable> qualifiedTables = Arrays.asList(new 
QualifiedTable("foo_db", "t_order"), new QualifiedTable("foo_db", 
"t_order_item"));
         SingleRule rule = createSingleRule(qualifiedTables);
         SelectStatementContext select = mockStatementContext();
-        Collection<DataNode> includedDataNodes = new 
HashSet<>(Collections.singleton(new DataNode("ds_0", "t_user")));
+        Collection<DataNode> includedDataNodes = new 
HashSet<>(Collections.singleton(new DataNode("ds_0", (String) null, "t_user")));
         when(rule.isAllTablesInSameComputeNode(includedDataNodes, 
qualifiedTables)).thenReturn(true);
         assertFalse(new SingleSQLFederationDecider().decide(select, 
Collections.emptyList(), mock(RuleMetaData.class), mockDatabase(), rule, 
includedDataNodes));
         assertThat(includedDataNodes.size(), is(3));
@@ -92,7 +92,7 @@ class SingleSQLFederationDeciderTest {
         Collection<QualifiedTable> qualifiedTables = Arrays.asList(new 
QualifiedTable("foo_db", "t_order"), new QualifiedTable("foo_db", 
"t_order_item"));
         SingleRule rule = createSingleRule(qualifiedTables);
         SelectStatementContext select = mockStatementContext();
-        Collection<DataNode> includedDataNodes = new 
HashSet<>(Collections.singleton(new DataNode("ds_1", "t_user")));
+        Collection<DataNode> includedDataNodes = new 
HashSet<>(Collections.singleton(new DataNode("ds_1", (String) null, "t_user")));
         when(rule.isAllTablesInSameComputeNode(includedDataNodes, 
qualifiedTables)).thenReturn(false);
         assertTrue(new SingleSQLFederationDecider().decide(select, 
Collections.emptyList(), mock(RuleMetaData.class), mockDatabase(), rule, 
includedDataNodes));
         assertThat(includedDataNodes.size(), is(3));
@@ -102,8 +102,8 @@ class SingleSQLFederationDeciderTest {
         SingleRule result = mock(SingleRule.class);
         when(result.getSingleTables(any())).thenReturn(qualifiedTables);
         MutableDataNodeRuleAttribute ruleAttribute = 
mock(MutableDataNodeRuleAttribute.class);
-        when(ruleAttribute.findTableDataNode("foo_db", 
"t_order")).thenReturn(Optional.of(new DataNode("ds_0", "t_order")));
-        when(ruleAttribute.findTableDataNode("foo_db", 
"t_order_item")).thenReturn(Optional.of(new DataNode("ds_0", "t_order_item")));
+        when(ruleAttribute.findTableDataNode("foo_db", 
"t_order")).thenReturn(Optional.of(new DataNode("ds_0", (String) null, 
"t_order")));
+        when(ruleAttribute.findTableDataNode("foo_db", 
"t_order_item")).thenReturn(Optional.of(new DataNode("ds_0", (String) null, 
"t_order_item")));
         when(result.getAttributes()).thenReturn(new 
RuleAttributes(ruleAttribute));
         return result;
     }
diff --git 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/InUsedSingleStorageUnitRetrieverTest.java
 
b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/InUsedSingleStorageUnitRetrieverTest.java
index d0a90afadfd..d8004ff94e2 100644
--- 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/InUsedSingleStorageUnitRetrieverTest.java
+++ 
b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/InUsedSingleStorageUnitRetrieverTest.java
@@ -47,7 +47,7 @@ class InUsedSingleStorageUnitRetrieverTest {
     private SingleRule mockRule() {
         SingleRule result = mock(SingleRule.class);
         SingleDataNodeRuleAttribute attribute = 
mock(SingleDataNodeRuleAttribute.class);
-        DataNode dataNode = new DataNode("foo_ds", "foo_table");
+        DataNode dataNode = new DataNode("foo_ds", (String) null, "foo_table");
         
when(attribute.getAllDataNodes()).thenReturn(Collections.singletonMap("foo_table",
 Collections.singletonList(dataNode)));
         when(result.getAttributes()).thenReturn(new RuleAttributes(attribute));
         return result;
diff --git 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTablesExecutorTest.java
 
b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTablesExecutorTest.java
index a26f45f3074..d1f86725da3 100644
--- 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTablesExecutorTest.java
+++ 
b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/ShowSingleTablesExecutorTest.java
@@ -44,8 +44,8 @@ class ShowSingleTablesExecutorTest {
     
     private static SingleRule mockRule() {
         Map<String, Collection<DataNode>> singleTableDataNodeMap = new 
HashMap<>(2, 1F);
-        singleTableDataNodeMap.put("t_order", Collections.singleton(new 
DataNode("ds_1", "t_order")));
-        singleTableDataNodeMap.put("t_order_item", Collections.singleton(new 
DataNode("ds_2", "t_order_item")));
+        singleTableDataNodeMap.put("t_order", Collections.singleton(new 
DataNode("ds_1", (String) null, "t_order")));
+        singleTableDataNodeMap.put("t_order_item", Collections.singleton(new 
DataNode("ds_2", (String) null, "t_order_item")));
         DataNodeRuleAttribute ruleAttribute = 
mock(DataNodeRuleAttribute.class);
         
when(ruleAttribute.getAllDataNodes()).thenReturn(singleTableDataNodeMap);
         SingleRule result = mock(SingleRule.class);
diff --git 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPITest.java
 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPITest.java
index 91b60d1e063..3da4a9d3330 100644
--- 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPITest.java
+++ 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPITest.java
@@ -258,20 +258,20 @@ class MigrationJobAPITest {
     @Test
     void assertCreateJobConfigFailedOnMoreThanOneSourceTable() {
         Collection<MigrationSourceTargetEntry> sourceTargetEntries = 
Stream.of("t_order_0", "t_order_1")
-                .map(each -> new MigrationSourceTargetEntry(new 
DataNode("ds_0", each), "t_order")).collect(Collectors.toList());
+                .map(each -> new MigrationSourceTargetEntry(new 
DataNode("ds_0", (String) null, each), "t_order")).collect(Collectors.toList());
         assertThrows(PipelineInvalidParameterException.class, () -> 
jobAPI.schedule(PipelineContextUtils.getContextKey(), sourceTargetEntries, 
"logic_db"));
     }
     
     @Test
     void assertCreateJobConfigFailedOnDataSourceNotExist() {
-        Collection<MigrationSourceTargetEntry> sourceTargetEntries = 
Collections.singleton(new MigrationSourceTargetEntry(new 
DataNode("ds_not_exists", "t_order"), "t_order"));
+        Collection<MigrationSourceTargetEntry> sourceTargetEntries = 
Collections.singleton(new MigrationSourceTargetEntry(new 
DataNode("ds_not_exists", (String) null, "t_order"), "t_order"));
         assertThrows(PipelineInvalidParameterException.class, () -> 
jobAPI.schedule(PipelineContextUtils.getContextKey(), sourceTargetEntries, 
"logic_db"));
     }
     
     @Test
     void assertCreateJobConfig() throws SQLException {
         initIntPrimaryEnvironment();
-        MigrationSourceTargetEntry sourceTargetEntry = new 
MigrationSourceTargetEntry(new DataNode("ds_0", "t_order"), "t_order");
+        MigrationSourceTargetEntry sourceTargetEntry = new 
MigrationSourceTargetEntry(new DataNode("ds_0", (String) null, "t_order"), 
"t_order");
         String jobId = jobAPI.schedule(PipelineContextUtils.getContextKey(), 
Collections.singleton(sourceTargetEntry), "logic_db");
         MigrationJobConfiguration actual = 
jobConfigManager.getJobConfiguration(jobId);
         assertThat(actual.getTargetDatabaseName(), is("logic_db"));

Reply via email to