pub async fn merge_batches(
table: DeltaTable,
source_batch: RecordBatch,
key_columns: &[String],
writer_id: &str,
epoch: u64,
schema_evolution: bool,
) -> Result<(DeltaTable, MergeResult), ConnectorError>Expand description
Performs a MERGE (upsert) of a source batch into a Delta Lake table.
Matches source rows to target rows by key_columns, then:
- Matched: update all non-key columns from source
- Not matched: insert all columns from source
§Arguments
table- The Delta Lake table handle (consumed and returned)source_batch- The sourceRecordBatchto mergekey_columns- Columns used to match source to target rowswriter_id- Unique writer identifier for exactly-once deduplicationepoch- The epoch number for this writeschema_evolution- If true, auto-merge new columns into the table schema
§Errors
Returns ConnectorError::WriteError if the merge fails.