Skip to content

Commit 28f1cd9

Browse files
author
Jan Kaul
committed
add documentation
1 parent 65637e5 commit 28f1cd9

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

  • iceberg-rust/src/table/transaction

iceberg-rust/src/table/transaction/mod.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,38 @@ impl<'table> TableTransaction<'table> {
176176
}
177177
self
178178
}
179-
/// Logically overwrites the data from the "files_to_overwrite" with the data in the "files"
179+
/// Overwrites specific data files in the table with new ones
180+
///
181+
/// This operation replaces specified existing data files with new ones, rather than
182+
/// replacing all files (like `replace`) or adding new files (like `append`). It allows
183+
/// for selective replacement of data files based on the mapping provided.
184+
///
185+
/// Multiple overwrite operations in the same transaction will be combined, with new
186+
/// data files appended and the files-to-overwrite mapping merged.
187+
///
188+
/// # Arguments
189+
/// * `files` - Vector of new data files to add to the table
190+
/// * `files_to_overwrite` - HashMap mapping manifest file paths to lists of data file
191+
/// paths that should be overwritten/replaced
192+
///
193+
/// # Returns
194+
/// * `Self` - The transaction builder for method chaining
195+
///
196+
/// # Examples
197+
/// ```
198+
/// use std::collections::HashMap;
199+
///
200+
/// let mut files_to_overwrite = HashMap::new();
201+
/// files_to_overwrite.insert(
202+
/// "manifest-001.avro".to_string(),
203+
/// vec!["data-001.parquet".to_string(), "data-002.parquet".to_string()]
204+
/// );
205+
///
206+
/// let transaction = table.new_transaction(None)
207+
/// .overwrite(new_data_files, files_to_overwrite)
208+
/// .commit()
209+
/// .await?;
210+
/// ```
180211
pub fn overwrite(
181212
mut self,
182213
files: Vec<DataFile>,

0 commit comments

Comments
 (0)