From 8c803d2f13363779e1eec02b2624a242f9f30779 Mon Sep 17 00:00:00 2001 From: Willi Raschkowski Date: Mon, 30 Dec 2024 17:37:01 +0100 Subject: [PATCH] Address comments from #822 --- crates/iceberg/src/lib.rs | 2 +- .../src/{metadata_scan.rs => metadata_table.rs} | 10 +++++----- crates/iceberg/src/table.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename crates/iceberg/src/{metadata_scan.rs => metadata_table.rs} (98%) diff --git a/crates/iceberg/src/lib.rs b/crates/iceberg/src/lib.rs index 1946f35f3..111b8a12f 100644 --- a/crates/iceberg/src/lib.rs +++ b/crates/iceberg/src/lib.rs @@ -73,7 +73,7 @@ mod avro; pub mod io; pub mod spec; -pub mod metadata_scan; +pub mod metadata_table; pub mod scan; pub mod expr; diff --git a/crates/iceberg/src/metadata_scan.rs b/crates/iceberg/src/metadata_table.rs similarity index 98% rename from crates/iceberg/src/metadata_scan.rs rename to crates/iceberg/src/metadata_table.rs index 7654e1f60..d2fd6e2f1 100644 --- a/crates/iceberg/src/metadata_scan.rs +++ b/crates/iceberg/src/metadata_table.rs @@ -36,11 +36,11 @@ use crate::Result; /// - /// - #[derive(Debug)] -pub struct MetadataTable(Table); +pub struct MetadataTable<'a>(&'a Table); -impl MetadataTable { +impl<'a> MetadataTable<'a> { /// Creates a new metadata scan. - pub(super) fn new(table: Table) -> Self { + pub(super) fn new(table: &'a Table) -> Self { Self(table) } @@ -65,7 +65,7 @@ impl MetadataTable { /// Snapshots table. pub struct SnapshotsTable<'a> { - metadata_table: &'a MetadataTable, + metadata_table: &'a MetadataTable<'a>, } impl<'a> SnapshotsTable<'a> { @@ -147,7 +147,7 @@ impl<'a> SnapshotsTable<'a> { /// `is_current_ancestor` indicates whether the snapshot is an ancestor of the /// current snapshot. If `false`, then the snapshot was rolled back. pub struct HistoryTable<'a> { - metadata_table: &'a MetadataTable, + metadata_table: &'a MetadataTable<'a>, } impl<'a> HistoryTable<'a> { diff --git a/crates/iceberg/src/table.rs b/crates/iceberg/src/table.rs index fa5304855..2a94a8ba3 100644 --- a/crates/iceberg/src/table.rs +++ b/crates/iceberg/src/table.rs @@ -22,7 +22,7 @@ use std::sync::Arc; use crate::arrow::ArrowReaderBuilder; use crate::io::object_cache::ObjectCache; use crate::io::FileIO; -use crate::metadata_scan::MetadataTable; +use crate::metadata_table::MetadataTable; use crate::scan::TableScanBuilder; use crate::spec::{TableMetadata, TableMetadataRef}; use crate::{Error, ErrorKind, Result, TableIdent}; @@ -203,7 +203,7 @@ impl Table { /// Creates a metadata table which provides table-like APIs for inspecting metadata. /// See [`MetadataTable`] for more details. - pub fn metadata_table(self) -> MetadataTable { + pub fn metadata_table(&self) -> MetadataTable<'_> { MetadataTable::new(self) }