strongduanmu commented on a change in pull request #10193:
URL: https://github.com/apache/shardingsphere/pull/10193#discussion_r622667824



##########
File path: 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingAlterTableStatementValidator.java
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl;
+
+import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.binder.type.TableAvailable;
+import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.route.context.RouteContext;
+import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sharding.rule.TableRule;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterTableStatement;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Sharding alter table statement validator.
+ */
+public final class ShardingAlterTableStatementValidator extends 
ShardingDDLStatementValidator<AlterTableStatement> {
+    
+    @Override
+    public void preValidate(final ShardingRule shardingRule, final 
SQLStatementContext<AlterTableStatement> sqlStatementContext, final 
List<Object> parameters, final ShardingSphereSchema schema) {
+        Collection<String> shardingLogicTableNames = 
getShardingLogicTableNames(shardingRule, sqlStatementContext);
+        if (shardingLogicTableNames.size() <= 1) {
+            return;
+        }

Review comment:
       > How about `broadcast Table`or `single table`?
   > Is #10172 a interim solution?
   
   @tristaZero Sorry for late reply, I spent some time sorting out the 
different scenes. According to the table type, there are sharding, broadcast 
and single table in SS. By combining with Cartesian product, we can get nine 
combination types.
   
   
   case | primary table | referenced table
   -- | -- | --
   1 | sharding | sharding
   2 | sharding | broadcast
   3 | sharding | single
   4 | broadcast | sharding
   5 | broadcast | broadcast
   6 | broadcast | single
   7 | single | sharding
   8 | single | broadcast
   9 | single | single
   
   ## case 1: sharding * sharding 
   There are two situations in this scenario. The sharding tables can be 
binding tables or unbinding tables.
   
   




-- 
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:
us...@infra.apache.org


Reply via email to