MCPcopy Create free account
hub / github.com/apache/paimon-rust / execute_delete

Function execute_delete

crates/integrations/datafusion/src/delete.rs:41–74  ·  view source on GitHub ↗

Execute a DELETE statement on a Paimon table. `table_ref` is the SQL table reference string (e.g. `"paimon.test_db.t"`), already extracted by the caller for catalog resolution.

(
    ctx: &SQLContext,
    delete: &Delete,
    table: Table,
    table_ref: &str,
)

Source from the content-addressed store, hash-verified

39/// `table_ref` is the SQL table reference string (e.g. `"paimon.test_db.t"`),
40/// already extracted by the caller for catalog resolution.
41pub(crate) async fn execute_delete(
42 ctx: &SQLContext,
43 delete: &Delete,
44 table: Table,
45 table_ref: &str,
46) -> DFResult<DataFrame> {
47 let tables = match &delete.from {
48 FromTable::WithFromKeyword(t) | FromTable::WithoutKeyword(t) => t,
49 };
50 if let Some(first) = tables.first() {
51 if let TableFactor::Table { alias: Some(a), .. } = &first.relation {
52 return Err(DataFusionError::Plan(format!(
53 "Table alias '{}' in DELETE is not yet supported",
54 a.name.value
55 )));
56 }
57 }
58
59 let schema = table.schema();
60 let core_options = CoreOptions::new(schema.options());
61
62 if core_options.data_evolution_enabled() {
63 return Err(DataFusionError::Plan(
64 "DELETE on data-evolution tables is not yet supported".to_string(),
65 ));
66 }
67 if !schema.trimmed_primary_keys().is_empty() {
68 return Err(DataFusionError::Plan(
69 "DELETE on primary-key tables is not yet supported".to_string(),
70 ));
71 }
72
73 execute_cow_delete(ctx, delete, &table, table_ref).await
74}
75
76/// Execute DELETE on an append-only table with retry on delete conflict.
77async fn execute_cow_delete(

Callers 1

handle_deleteMethod · 0.85

Calls 7

execute_cow_deleteFunction · 0.85
trimmed_primary_keysMethod · 0.80
PlanClass · 0.50
schemaMethod · 0.45
optionsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected