zhannngchen commented on code in PR #49905:
URL: https://github.com/apache/doris/pull/49905#discussion_r2034806246


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -2589,10 +2589,25 @@ private boolean createOlapTable(Database db, 
CreateTableStmt stmt) throws UserEx
         // use light schema change optimization
         olapTable.setDisableAutoCompaction(disableAutoCompaction);
 
+        boolean enableUniqueKeyMergeOnWrite = false;
+        if (keysType == KeysType.UNIQUE_KEYS) {
+            try {
+                enableUniqueKeyMergeOnWrite = 
PropertyAnalyzer.analyzeUniqueKeyMergeOnWrite(properties);
+            } catch (AnalysisException e) {
+                throw new DdlException(e.getMessage());
+            }
+            if (enableUniqueKeyMergeOnWrite && !enableLightSchemaChange && 
!CollectionUtils.isEmpty(
+                    keysDesc.getClusterKeysColumnNames())) {
+                throw new DdlException(
+                        "Unique merge-on-write tables with cluster keys 
require light schema change to be enabled.");
+            }
+        }
+        olapTable.setEnableUniqueKeyMergeOnWrite(enableUniqueKeyMergeOnWrite);
+
         // set compaction policy
         String compactionPolicy = 
PropertyAnalyzer.SIZE_BASED_COMPACTION_POLICY;
         try {
-            compactionPolicy = 
PropertyAnalyzer.analyzeCompactionPolicy(properties);
+            compactionPolicy = 
PropertyAnalyzer.analyzeCompactionPolicy(properties, 
enableUniqueKeyMergeOnWrite);

Review Comment:
   and should disable time series compaction for all unique key data model



-- 
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: commits-unsubscr...@doris.apache.org

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