From 05a614ef28dfa4e3be0ae8b3990e17e065c27199 Mon Sep 17 00:00:00 2001 From: xxchan Date: Wed, 18 Dec 2024 21:34:02 +0800 Subject: [PATCH] improve doc Signed-off-by: xxchan --- crates/iceberg/src/metadata_scan.rs | 20 +++++++++----------- crates/iceberg/src/table.rs | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/crates/iceberg/src/metadata_scan.rs b/crates/iceberg/src/metadata_scan.rs index 6205d6e01..fa58acfb7 100644 --- a/crates/iceberg/src/metadata_scan.rs +++ b/crates/iceberg/src/metadata_scan.rs @@ -29,6 +29,10 @@ use crate::table::Table; use crate::Result; /// Table metadata scan. +/// +/// Used to inspect a table's history, snapshots, and other metadata as a table. +/// +/// See also . #[derive(Debug)] pub struct MetadataScan { metadata_ref: TableMetadataRef, @@ -48,6 +52,10 @@ impl MetadataScan { } } +/// Table metadata scan. +/// +/// Use to inspect a table's history, snapshots, and other metadata as a table. +/// /// References: /// - /// - @@ -65,15 +73,6 @@ pub struct SnapshotsTable; impl MetadataTable for SnapshotsTable { fn schema() -> Schema { - // committed_at: timestamp[ms] not null - // snapshot_id: int64 not null - // parent_id: int64 - // operation: string - // manifest_list: string not null - // summary: map - // child 0, entries: struct not null - // child 0, key: string not null - // child 1, value: string Schema::new(vec![ Field::new( "committed_at", @@ -196,8 +195,7 @@ mod tests { #[test] fn test_snapshots_table() { let table = TableTestFixture::new().table; - let scan = MetadataScan::new(&table); - let record_batch = SnapshotsTable::scan(&scan).unwrap(); + let record_batch = table.metadata_scan().snapshots(); check_record_batch( record_batch, expect![[r#" diff --git a/crates/iceberg/src/table.rs b/crates/iceberg/src/table.rs index 6c5823f94..f78e04e2f 100644 --- a/crates/iceberg/src/table.rs +++ b/crates/iceberg/src/table.rs @@ -201,7 +201,7 @@ impl Table { TableScanBuilder::new(self) } - /// Creates a metadata scan. + /// Creates a metadata scan. See [`MetadataScan`] for more details. pub fn metadata_scan(&self) -> MetadataScan { MetadataScan::new(self) }