morningman commented on a change in pull request #3981:
URL: https://github.com/apache/incubator-doris/pull/3981#discussion_r450944928



##########
File path: fe/src/main/java/org/apache/doris/analysis/ModifyPartitionClause.java
##########
@@ -17,28 +17,41 @@
 
 package org.apache.doris.analysis;
 
+import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;

Review comment:
       Import order

##########
File path: fe/src/main/java/org/apache/doris/analysis/ModifyPartitionClause.java
##########
@@ -48,27 +61,80 @@ public ModifyPartitionClause(String partitionName, 
Map<String, String> propertie
         this.needTableStable = false;
     }
 
+    // c'tor for 'Modify Partition(*)' clause
+    private ModifyPartitionClause(Map<String, String> properties) {
+        super(AlterOpType.MODIFY_PARTITION);
+        this.partitionNames = Lists.newArrayList();
+        this.properties = properties;
+        this.needExpand = true;
+        this.needTableStable = false;
+    }
+
+    public static ModifyPartitionClause createStarClause(Map<String, String> 
properties) {
+        return new ModifyPartitionClause(properties);
+    }
+
     @Override
     public void analyze(Analyzer analyzer) throws AnalysisException {
-        if (Strings.isNullOrEmpty(partitionName)) {
-            throw new AnalysisException("Partition name is not set");
+        if (partitionNames == null || (!needExpand && 
partitionNames.isEmpty())) {
+            throw new AnalysisException("Partition names is not set or empty");
+        }
+
+        if (partitionNames.stream().anyMatch(entity -> 
Strings.isNullOrEmpty(entity))) {
+            throw new AnalysisException("there are empty partition name");
         }
 
         if (properties == null || properties.isEmpty()) {
             throw new AnalysisException("Properties is not set");
         }
+
+        // check properties here
+        preCheck(Maps.newHashMap(properties));
+    }
+
+    // pre check the following properties' legality before modifying partition.
+    // 1. replication_num
+    // 2. storage_medium && storage_cooldown_time
+    // 3. in_memory
+    // 4. tablet type
+    public static void preCheck(Map<String, String> properties) throws 
AnalysisException {

Review comment:
       private, and no need to be static. And method name can be changed to 
`checkProperties`.

##########
File path: 
fe/src/main/java/org/apache/doris/persist/BatchModifyPartitionsInfo.java
##########
@@ -0,0 +1,55 @@
+// 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.doris.persist;
+
+import com.google.gson.annotations.SerializedName;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.persist.gson.GsonUtils;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * used for batch modify multi partitions in one atomic operation
+ */
+
+public class BatchModifyPartitionsInfo implements Writable {

Review comment:
       Add UT to test the read/write method of this class




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to