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


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/NativeInsertStmt.java:
##########
@@ -914,4 +918,60 @@ public RedirectStatus getRedirectStatus() {
             return RedirectStatus.FORWARD_WITH_SYNC;
         }
     }
+
+    public void setIsFromDeleteOrUpdateStmt(boolean isFromDeleteOrUpdateStmt) {
+        this.isFromDeleteOrUpdateStmt = isFromDeleteOrUpdateStmt;
+    }
+
+    private void trySetPartialUpdate() throws UserException {
+        LOG.info("[trySetPartialUpdate] {}, {}, {}", isFromDeleteOrUpdateStmt, 
isPartialUpdate, targetTable);
+        if (isFromDeleteOrUpdateStmt || isPartialUpdate || !(targetTable 
instanceof OlapTable)) {
+            return;
+        }
+        OlapTable olapTable = (OlapTable) targetTable;
+        LOG.info("[trySetPartialUpdate] targetColumns: {}; FullSchema: {}", 
targetColumns, olapTable.getFullSchema());
+        if (!olapTable.getEnableUniqueKeyMergeOnWrite()) {
+            LOG.info("[trySetPartialUpdate] not MOW");
+            return;
+        }
+        int count = 0;
+        for (Column col : olapTable.getFullSchema()) {
+            boolean exists = false;
+            for (Column insertCol : targetColumns) {
+                if (insertCol.getName() != null && 
insertCol.getName().equals(col.getName())) {
+                    if (!col.isVisible()) {
+                        return;
+                    }
+                    exists = true;
+                    break;
+                }
+            }
+            LOG.info("col: {}, exists: {}, visible: {}", col, exists, 
col.isVisible());
+            if (col.isKey() && !exists) {
+                throw new UserException("Partial update should include all key 
columns, missing: " + col.getName());
+            }
+            if (exists || (col.isVisible() && !col.hasDefaultValue())) {
+                ++count;
+            }
+        }
+        LOG.info("[trySetPartialUpdate]: count: {}, targetColumns.size(): {}", 
count, targetColumns.size());

Review Comment:
   Too many info logs here, most of them should be debug level



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