Skip to content

[fix](dml) Enforce partition guard for delete - #67252

Open
Yukang-Lian wants to merge 1 commit into
apache:masterfrom
Yukang-Lian:codex/fix-nereids-delete-partition-guard
Open

[fix](dml) Enforce partition guard for delete#67252
Yukang-Lian wants to merge 1 commit into
apache:masterfrom
Yukang-Lian:codex/fix-nereids-delete-partition-guard

Conversation

@Yukang-Lian

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: None

Related PR: #62944

Problem Summary: Nereids predicate DELETE bypassed delete_without_partition for non-Unique range and list tables after partition pruning moved into the planner. A predicate that did not restrict the target partitions could therefore delete across every partition while the safety switch was false, even though unpartitioned tables must remain allowed. Use the physical scan effective partition-pruning signal to reject only non-Unique partitioned deletes that neither specify nor restrict partitions, while preserving Unique and DELETE USING behavior.

Release note

Nereids DELETE now honors delete_without_partition for non-Unique range and list tables when no effective partition target is specified.

Check List (For Author)

  • Test: Unit Test and regression test case
    • ./run-fe-ut.sh --run org.apache.doris.nereids.trees.plans.commands.DeleteFromCommandTest
    • ./run-fe-ut.sh --run org.apache.doris.nereids.rules.rewrite.PartitionPrunerTest
    • Added delete_p0/test_basic_delete_job coverage; not run locally because this worktree has no FE/BE cluster output
  • Behavior changed: Yes. Unsafe full-partition predicate deletes now require delete_without_partition=true on non-Unique range/list tables; unpartitioned and Unique table behavior is unchanged.
  • Does this need documentation: No. The change restores the documented safety-switch behavior.

Co-authored-by: Siyang Tang tangsiyang@selectdb.com

### What problem does this PR solve?

Issue Number: None

Related PR: apache#62944

Problem Summary: Nereids predicate DELETE bypassed delete_without_partition for non-Unique range and list tables after partition pruning moved into the planner. A predicate that did not restrict the target partitions could therefore delete across every partition while the safety switch was false, even though unpartitioned tables must remain allowed. Use the physical scan effective partition-pruning signal to reject only non-Unique partitioned deletes that neither specify nor restrict partitions, while preserving Unique and DELETE USING behavior.

### Release note

Nereids DELETE now honors delete_without_partition for non-Unique range and list tables when no effective partition target is specified.

### Check List (For Author)

- Test: Unit Test and regression test case
    - ./run-fe-ut.sh --run org.apache.doris.nereids.trees.plans.commands.DeleteFromCommandTest
    - ./run-fe-ut.sh --run org.apache.doris.nereids.rules.rewrite.PartitionPrunerTest
    - Added delete_p0/test_basic_delete_job coverage; not run locally because this worktree has no FE/BE cluster output
- Behavior changed: Yes. Unsafe full-partition predicate deletes now require delete_without_partition=true on non-Unique range/list tables; unpartitioned and Unique table behavior is unchanged.
- Does this need documentation: No. The change restores the documented safety-switch behavior.

Co-authored-by: Siyang Tang <tangsiyang@selectdb.com>
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morrySnow morrySnow changed the title [fix](fe) Enforce partition guard for Nereids delete [fix](dml) Enforce partition guard for Nereids delete Aug 28, 2026
@morrySnow morrySnow changed the title [fix](dml) Enforce partition guard for Nereids delete [fix](dml) Enforce partition guard for delete Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants