github-actions[bot] commented on code in PR #63182:
URL: https://github.com/apache/doris/pull/63182#discussion_r3253288157


##########
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java:
##########
@@ -2112,29 +2189,53 @@ private void validateFlexiblePartialUpdateForAlter() 
throws UserException {
         }
         OlapTable olapTable = (OlapTable) table;
 
-        // Validate table-level constraints (MoW, skip_bitmap, 
light_schema_change, variant columns)
+        // Validate table-level constraints (MoW, skip_bitmap, 
light_schema_change)
         olapTable.validateForFlexiblePartialUpdate();
 
+        Map<String, String> mergedJobProperties = 
Maps.newHashMap(this.jobProperties);
+        mergedJobProperties.putAll(newJobProperties);
+
         // Routine load specific validations
         // Must use JSON format
-        String format = 
this.jobProperties.getOrDefault(FileFormatProperties.PROP_FORMAT, "csv");
+        String format = 
mergedJobProperties.getOrDefault(FileFormatProperties.PROP_FORMAT, "csv");
         if (!"json".equalsIgnoreCase(format)) {
             throw new DdlException("Flexible partial update only supports JSON 
format, but current job uses: "
                     + format);
         }
         // Cannot use fuzzy_parse
-        if (Boolean.parseBoolean(this.jobProperties.getOrDefault(
+        if (Boolean.parseBoolean(mergedJobProperties.getOrDefault(
                 JsonFileFormatProperties.PROP_FUZZY_PARSE, "false"))) {
             throw new DdlException("Flexible partial update does not support 
fuzzy_parse");
         }
         // Cannot use jsonpaths
-        String jsonPaths = getJsonPaths();
+        String jsonPaths = 
mergedJobProperties.get(JsonFileFormatProperties.PROP_JSON_PATHS);
         if (jsonPaths != null && !jsonPaths.isEmpty()) {
             throw new DdlException("Flexible partial update does not support 
jsonpaths");
         }
         // Cannot specify COLUMNS mapping
-        if (columnDescs != null && !columnDescs.descs.isEmpty()) {
+        if ((columnDescs != null && !columnDescs.descs.isEmpty())
+                || (newRoutineLoadDesc != null && 
newRoutineLoadDesc.getColumnsInfo() != null
+                && !newRoutineLoadDesc.getColumnsInfo().isEmpty())) {
             throw new DdlException("Flexible partial update does not support 
COLUMNS specification");
         }
+        validateRoutineLoadDescForFlexiblePartialUpdate(newRoutineLoadDesc);
+    }
+
+    private void 
validateRoutineLoadDescForFlexiblePartialUpdate(RoutineLoadDesc 
newRoutineLoadDesc)
+            throws DdlException {
+        boolean newDescHasExplicitMergeType = newRoutineLoadDesc != null
+                && (newRoutineLoadDesc.isMergeTypeSpecified()
+                        || newRoutineLoadDesc.getMergeType() != 
LoadTask.MergeType.APPEND);
+        if (mergeTypeSpecified || mergeType != LoadTask.MergeType.APPEND || 
newDescHasExplicitMergeType) {
+            throw new DdlException("Don't support flexible partial update when 
'merge_type' is specified");
+        }
+        if (whereExpr != null || (newRoutineLoadDesc != null && 
newRoutineLoadDesc.getFilter() != null)) {
+            throw new DdlException("Don't support flexible partial update when 
'where' is specified");

Review Comment:
   This descriptor validation still allows a flexible routine-load job to 
install a `DELETE ON` clause. A concrete path is: create a JSON routine load in 
`UPDATE_FLEXIBLE_COLUMNS`, pause it, then run `ALTER ROUTINE LOAD ... DELETE ON 
is_delete = 1`. `validateFlexiblePartialUpdateForAlter()` calls this helper, 
but the helper only rejects merge type, `WHERE`, and sequence column; 
`setRoutineLoadDesc()` then persists `deleteCondition`. Subsequent planning 
rejects the job in 
`NereidsStreamLoadPlanner.validateLoadTaskForFlexiblePartialUpdate()` because 
`taskInfo.getDeleteCondition() != null`, so the accepted ALTER leaves the job 
unable to schedule tasks. Please reject existing or incoming `deleteCondition` 
here, and add a negative ALTER test for adding `DELETE ON` to an 
already-flexible routine-load job.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to