sandynz commented on code in PR #30395:
URL: https://github.com/apache/shardingsphere/pull/30395#discussion_r1512141539


##########
kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/update/MigrateTableExecutor.java:
##########
@@ -47,7 +49,15 @@ public void executeUpdate(final MigrateTableStatement 
sqlStatement, final Contex
         ShardingSpherePreconditions.checkState(instanceContext.isCluster(),
                 () -> new 
PipelineInvalidParameterException(String.format("Only `Cluster` is supported 
now, but current mode type is `%s`", 
instanceContext.getModeConfiguration().getType())));
         checkTargetDatabase(sqlStatement);
-        String targetDatabaseName = null == 
sqlStatement.getTargetDatabaseName() ? database.getName() : 
sqlStatement.getTargetDatabaseName();
+        String targetDatabaseName;
+        if (Strings.isNullOrEmpty(sqlStatement.getTargetDatabaseName())) {
+            targetDatabaseName = database.getName();
+        } else {
+            ShardingSphereDatabase targetDatabase = 
PipelineContextManager.getProxyContext().getContextManager().getDatabase(sqlStatement.getTargetDatabaseName());
+            ShardingSpherePreconditions.checkNotNull(targetDatabase, () -> new 
PipelineInvalidParameterException(String.format("Target database `%s` is not 
exists",
+                    sqlStatement.getTargetDatabaseName())));
+            targetDatabaseName = targetDatabase.getName();

Review Comment:
   Is `targetDatabaseName = targetDatabase.getName();` necessary? Migration is 
compatible with upper and lower database name.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to