yujun777 opened a new pull request, #70287:
URL: https://github.com/apache/doris/pull/70287

   ### Background
   
   Doris accepts both partition-name lists and static partition assignments in 
INSERT statements. Static assignments such as `PARTITION(dt='2026-11-04')` are 
supported by external-table write paths; OLAP tables use partition names, or 
`PARTITION(*)` for automatic overwrite partition detection.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #58396 (introduced static partition overwrite syntax)
   PR Type: Bugfix
   
   Problem Summary:
   
   An INSERT OVERWRITE on an OLAP table accepts `PARTITION(dt='2026-11-04')` 
but silently discards the static partition assignments when creating the table 
sink. The resulting empty partition-name list is treated as a whole-table 
overwrite, so data in unrelated partitions is removed. Reject static partition 
assignments before constructing an OLAP sink, for both INSERT INTO and INSERT 
OVERWRITE, including remote Doris targets. The error directs users to partition 
names or automatic overwrite partition detection.
   
   ### Details
   
   - **Frequency:** Reproducible whenever an OLAP INSERT OVERWRITE specifies 
static partition assignments; ordinary INSERT INTO silently ignores the same 
assignments.
   - **Root cause:** The parser preserves assignments separately from partition 
names, but both OLAP sink creation entry points ignore the assignments.
   - **Why existing tests missed it:** Parser tests verify that assignments are 
accepted, and external-table tests exercise supported static partition writes. 
They do not check that OLAP targets reject the unsupported syntax or preserve 
unrelated partitions.
   - **Fix:** Share an admission check between both OLAP sink creation entry 
points and raise an analysis error before any write or partition replacement.
   - **Other paths and branches:** External connector sinks retain their static 
partition assignments. Partition-name inserts, partition-name overwrites, 
automatic partition detection, and explicit whole-table overwrites retain their 
behavior.
   
   ### Testing
   
   All checks ran locally:
   
   - `./build.sh --fe`: passed, with Checkstyle enabled.
   - `tools/fast-fe-ut.sh 
UnboundTableSinkCreatorTest,ParseInsertPartitionSpecTest,InsertPartitionSpecTest`:
 passed via its full-runner fallback, 29 tests, zero failures/errors.
   - Separate FE Core reactor `mvn validate -DskipTests`: passed.
   - `test_olap_static_partition_rejected`: failed as expected on the pre-fix 
FE because the unsupported INSERT INTO succeeded; passed on the fixed FE. 
Generated its golden file with the regression runner and checked that rejected 
statements preserve both partitions.
   - `./run-regression-test.sh --run -d insert_overwrite_p0 -s 
test_olap_static_partition_rejected,test_iot_range_nereids,test_iot_list_nereids,test_iot_auto_detect`:
 all four suites passed. Covers named-partition INSERT/OVERWRITE, automatic 
overwrite partition detection, whole-table overwrite, and rejection with empty 
input.
   - Local self-review: checked both sink creation entry points and verified 
that external connector sinks retain static partition assignments. No locking 
or transaction flow changes.
   
   ### Release note
   
   OLAP INSERT INTO and INSERT OVERWRITE now reject unsupported 
`PARTITION(column=value)` assignments instead of silently ignoring them. This 
prevents an intended partition overwrite from becoming a whole-table overwrite. 
Specify partition names, or use `PARTITION(*)` for INSERT OVERWRITE.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (unsupported static partition assignments on OLAP 
targets now fail)
   - Does this need documentation: No (rejects unsupported syntax; supported 
OLAP partition syntax is unchanged)
   - Pre-submission status: Ready
   


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