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



##########
File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3334,6 +3334,45 @@ public void replayRecoverPartition(RecoverInfo info) {
         }
     }
 
+    /**
+     * Batch update partitions' properties
+     * caller should hold the db lock
+     */
+    public void modifyPartitionsProperty(Database db,
+                                         OlapTable olapTable,
+                                         List<String> partitionNames,
+                                         Map<String, String> properties)
+            throws DdlException {
+        Preconditions.checkArgument(db.isWriteLockHeldByCurrentThread());
+        if (olapTable.getState() != OlapTableState.NORMAL) {
+            throw new DdlException("Table[" + olapTable.getName() + "]'s state 
is not NORMAL");
+        }
+
+        for (String partitionName : partitionNames) {
+            Partition partition = olapTable.getPartition(partitionName);
+            if (partition == null) {
+                throw new DdlException(
+                        "Partition[" + partitionName + "] does not exist in 
table[" + olapTable.getName() + "]");
+            }
+        }
+
+        // If error occurs tell user which partition is wrong.
+        for (String partitionName : partitionNames) {
+            try {
+                Map<String, String> partitionProperties = 
Maps.newHashMap(properties);
+                modifyPartitionProperty(db, olapTable, partitionName, 
partitionProperties);

Review comment:
       better to write meta in one edit log

##########
File path: fe/src/main/java/org/apache/doris/analysis/ModifyPartitionClause.java
##########
@@ -48,10 +56,27 @@ 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;
+    }
+
+    static public ModifyPartitionClause createStarClause(Map<String, String> 
properties) {

Review comment:
       ```suggestion
       public static ModifyPartitionClause createStarClause(Map<String, String> 
properties) {
   ```




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