Skip to content

Commit f96922e

Browse files
committed
Improve comments
1 parent 7bd4242 commit f96922e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

crates/iceberg/src/spec/table_metadata.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,22 @@ impl TableMetadata {
308308
&self.properties
309309
}
310310

311-
/// Normalize this partition spec. This is an internal method
311+
/// Normalize this partition spec.
312+
///
313+
/// This is an internal method
312314
/// meant to be called after constructing table metadata from untrusted sources.
313315
/// We run this method after json deserialization.
314316
/// All constructors for `TableMetadata` which are part of `iceberg-rust`
315317
/// should return normalized `TableMetadata`.
318+
///
319+
/// It does:
320+
/// * Validate the current schema is set and valid
321+
/// * Validate that all refs are valid (snapshot exists)
322+
/// * Validate logs are chronological
323+
/// * Normalize location (remove trailing slash)
324+
/// * Validate that for V1 Metadata the last_sequence_number is 0
325+
/// * If the default partition spec is specified but the spec is not present in specs, add it
326+
/// * If the default sort order is unsorted but the sort order is not present, add it
316327
pub(super) fn try_normalize(&mut self) -> Result<&mut Self> {
317328
self.validate_current_schema()?;
318329
self.normalize_current_snapshot()?;

0 commit comments

Comments
 (0)