Skip to main content

uni_query/query/df_graph/
mutation_delete.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2024-2026 Dragonscale Team
3
4//! DataFusion ExecutionPlan for Cypher DELETE and DETACH DELETE clauses.
5//!
6//! Thin wrapper around [`MutationExec`] with a typed constructor that builds
7//! the correct [`MutationKind::Delete`] variant.
8
9use super::mutation_common::{MutationContext, MutationExec, MutationKind};
10use datafusion::physical_plan::ExecutionPlan;
11use std::sync::Arc;
12use uni_cypher::ast::Expr;
13
14/// Type alias for a DELETE mutation execution plan.
15pub type MutationDeleteExec = MutationExec;
16
17/// Create a new `MutationExec` configured for a DELETE clause.
18pub fn new_delete_exec(
19    input: Arc<dyn ExecutionPlan>,
20    items: Vec<Expr>,
21    detach: bool,
22    mutation_ctx: Arc<MutationContext>,
23) -> MutationDeleteExec {
24    MutationExec::new(
25        input,
26        MutationKind::Delete { items, detach },
27        "MutationDeleteExec",
28        mutation_ctx,
29    )
30}