You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/08/18 10:44:09 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #4378: FIX: fix dynamic partition replicationNum error

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



##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3973,43 +3974,55 @@ public static void getDdlStmt(Table table, List<String> createTableStmt, List<St
             // bloom filter
             Set<String> bfColumnNames = olapTable.getCopiedBfColumns();
             if (bfColumnNames != null) {
-                sb.append(",\n\"").append(PropertyAnalyzer.PROPERTIES_BF_COLUMNS).append("\" = \"");
-                sb.append(Joiner.on(", ").join(olapTable.getCopiedBfColumns())).append("\"");
+                appendProperties(sb, PropertyAnalyzer.PROPERTIES_BF_COLUMNS, Joiner.on(", ").join(olapTable.getCopiedBfColumns()));
             }
 
             if (separatePartition) {
                 // version info
-                sb.append(",\n\"").append(PropertyAnalyzer.PROPERTIES_VERSION_INFO).append("\" = \"");
-                Partition partition = null;
+                Partition partition;
                 if (olapTable.getPartitionInfo().getType() == PartitionType.UNPARTITIONED) {
                     partition = olapTable.getPartition(olapTable.getName());
                 } else {
                     Preconditions.checkState(partitionId.size() == 1);
                     partition = olapTable.getPartition(partitionId.get(0));
                 }
-                sb.append(Joiner.on(",").join(partition.getVisibleVersion(), partition.getVisibleVersionHash()))
-                        .append("\"");
+                appendProperties(sb, PropertyAnalyzer.PROPERTIES_VERSION_INFO, Joiner.on(",").join(partition.getVisibleVersion(), partition.getVisibleVersionHash()));
             }
 
             // colocateTable
             String colocateTable = olapTable.getColocateGroup();
             if (colocateTable != null) {
-                sb.append(",\n\"").append(PropertyAnalyzer.PROPERTIES_COLOCATE_WITH).append("\" = \"");
-                sb.append(colocateTable).append("\"");
+                appendProperties(sb, PropertyAnalyzer.PROPERTIES_COLOCATE_WITH, colocateTable);
             }
 
             // dynamic partition
             if (olapTable.dynamicPartitionExists()) {
-                sb.append(olapTable.getTableProperty().getDynamicPartitionProperty().toString());
+                DynamicPartitionProperty dynamicPartitionProperty = olapTable.getTableProperty().getDynamicPartitionProperty();
+                appendProperties(sb, DynamicPartitionProperty.ENABLE, dynamicPartitionProperty.getEnable());

Review comment:
       This is not a good implments. Could you move these `appendProperties` into a method of `DynamicPartitionProperty`. So that if we add more properties in future, we only need to modify one place.
   You can pass the table's default replication number to that method.




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



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