mymeiyi commented on code in PR #31461:
URL: https://github.com/apache/doris/pull/31461#discussion_r1516004054


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java:
##########
@@ -149,16 +157,40 @@ public LogicalPlan completeQueryPlan(ConnectContext ctx, 
LogicalPlan logicalQuer
                     + String.join(", ", colNameToExpression.keySet()));
         }
 
-        logicalQuery = new LogicalProject<>(selectItems, logicalQuery);
-        if (cte.isPresent()) {
-            logicalQuery = ((LogicalPlan) 
cte.get().withChildren(logicalQuery));
-        }
         boolean isPartialUpdate = targetTable.getEnableUniqueKeyMergeOnWrite()
                 && selectItems.size() < targetTable.getColumns().size()
-                && !targetTable.hasVariantColumns();
+                && !targetTable.hasVariantColumns() && 
targetTable.getSequenceCol() == null
+                && partialUpdateColNameToExpression.size() <= 
targetTable.getFullSchema().size() * 3 / 10;
+
+        List<String> partialUpdateColNames = new ArrayList<>();
+        List<NamedExpression> partialUpdateSelectItems = new ArrayList<>();
+        if (isPartialUpdate) {
+            for (Column column : targetTable.getFullSchema()) {
+                Expression expr = new 
NereidsParser().parseExpression(tableName + "." + column.getName());
+                boolean existInExpr = false;
+                for (String colName : 
partialUpdateColNameToExpression.keySet()) {
+                    if (Objects.equals(colName, column.getName())) {

Review Comment:
   Do we need to use `compareToIgnoreCase`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java:
##########
@@ -149,16 +157,40 @@ public LogicalPlan completeQueryPlan(ConnectContext ctx, 
LogicalPlan logicalQuer
                     + String.join(", ", colNameToExpression.keySet()));
         }
 
-        logicalQuery = new LogicalProject<>(selectItems, logicalQuery);
-        if (cte.isPresent()) {
-            logicalQuery = ((LogicalPlan) 
cte.get().withChildren(logicalQuery));
-        }
         boolean isPartialUpdate = targetTable.getEnableUniqueKeyMergeOnWrite()
                 && selectItems.size() < targetTable.getColumns().size()
-                && !targetTable.hasVariantColumns();
+                && !targetTable.hasVariantColumns() && 
targetTable.getSequenceCol() == null
+                && partialUpdateColNameToExpression.size() <= 
targetTable.getFullSchema().size() * 3 / 10;
+
+        List<String> partialUpdateColNames = new ArrayList<>();
+        List<NamedExpression> partialUpdateSelectItems = new ArrayList<>();
+        if (isPartialUpdate) {
+            for (Column column : targetTable.getFullSchema()) {
+                Expression expr = new 
NereidsParser().parseExpression(tableName + "." + column.getName());
+                boolean existInExpr = false;
+                for (String colName : 
partialUpdateColNameToExpression.keySet()) {
+                    if (Objects.equals(colName, column.getName())) {

Review Comment:
   Do we need to use `compareToIgnoreCase`?



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