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

Function execute_update

crates/integrations/datafusion/src/update.rs:45–69  ·  view source on GitHub ↗

Execute an UPDATE statement on a Paimon table.

(
    ctx: &SQLContext,
    update: &Update,
    table: Table,
)

Source from the content-addressed store, hash-verified

43
44/// Execute an UPDATE statement on a Paimon table.
45pub(crate) async fn execute_update(
46 ctx: &SQLContext,
47 update: &Update,
48 table: Table,
49) -> DFResult<DataFrame> {
50 if let TableFactor::Table { alias: Some(a), .. } = &update.table.relation {
51 return Err(DataFusionError::Plan(format!(
52 "Table alias '{}' in UPDATE is not yet supported",
53 a.name.value
54 )));
55 }
56
57 let schema = table.schema();
58 let core_options = CoreOptions::new(schema.options());
59
60 if core_options.data_evolution_enabled() {
61 execute_data_evolution_update(ctx, update, table).await
62 } else if schema.trimmed_primary_keys().is_empty() {
63 execute_cow_update(ctx, update, &table).await
64 } else {
65 Err(DataFusionError::Plan(
66 "UPDATE on primary-key tables without data-evolution is not supported".to_string(),
67 ))
68 }
69}
70
71// ---------------------------------------------------------------------------
72// Data evolution path

Calls 8

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